General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
208946170 Practice:
sandeep_iitpkd
282B - 25 C++17 (GCC 7-32) Time limit exceeded on test 10 5000 ms 8 KB 2023-06-08 06:10:15 2023-06-08 06:10:15
→ Source
#include <iostream>
using namespace std;
// greedy
// it can be proved that '-1' will not occur
int main(){
    int n, a, g;
    cin >> n;

    int sum {0};
    for(int i = 0; i < n; i ++){
        cin >> a >> g;
        if(sum + a <= 500){
            cout << "A";
            sum += a;
        }else{
            cout << "G";
            sum -= g;
        }
    }
    cout << endl;
    return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details