Submission #136862

#TimeUsernameProblemLanguageResultExecution timeMemory
136862choikiwonBodyguards (CEOI10_bodyguards)C++17
50 / 100
504 ms262148 KiB
#include<bits/stdc++.h> using namespace std; int R, C; vector<int> X, Y; int main() { std::ios::sync_with_stdio(false); cin >> R; for(int i = 0; i < R; i++) { int a, b; cin >> a >> b; for(int j = 0; j < b; j++) X.push_back(a); } cin >> C; for(int i = 0; i < C; i++) { int a, b; cin >> a >> b; for(int j = 0; j < b; j++) Y.push_back(a); } for(int i = 0; i < X.size(); i++) { sort(Y.begin(), Y.end()); if(X[i] > Y.size()) { cout << 0; return 0; } for(int j = (int)Y.size() - 1; j >= (int)Y.size() - X[i]; j--) { if(!Y[j]) { cout << 0; return 0; } Y[j]--; } } for(int i = 0; i < Y.size(); i++) if(Y[i]) { cout << 0; return 0; } cout << 1; }

Compilation message (stderr)

bodyguards.cpp: In function 'int main()':
bodyguards.cpp:26:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < X.size(); i++) {
                    ~~^~~~~~~~~~
bodyguards.cpp:29:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(X[i] > Y.size()) {
bodyguards.cpp:42:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < Y.size(); i++) if(Y[i]) {
                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...