Placar do Jogo

Problem Link

Solution by dudu100 pts

Code / Notes

#include <bits/stdc++.h>
using namespace std;

int main() {
    int P;
    cin >> P;
    vector<int> GP(P);
    for (int i = 0; i < P; i++) {
        cin >> GP[i];
    }

    int C;
    cin >> C;
    vector<int> GC(C);
    for (int i = 0; i < C; i++) {
        cin >> GC[i];
    }

    cout << 0 << ' ' << 0 << endl;

    int ip = 0, ic = 0;
    for (int i = 0; i < P+C; i++) {
        if (ic == C) {
            ip++;
        } else if (ip == P) {
            ic++;
        } else if (GP[ip] < GC[ic]) {
            ip++;
        } else {
            ic++;
        }
        cout << ip << ' ' << ic << endl;
    }
}

Last updated 1 month, 3 weeks ago


« Back to problem