Submission #87034

#TimeUsernameProblemLanguageResultExecution timeMemory
87034mirbek01Weighting stones (IZhO11_stones)C++17
0 / 100
1076 ms1328 KiB
# include <bits/stdc++.h> using namespace std; int q; set <int> s1, s2; int main(){ scanf("%d", &q); while(q --){ int val, type; cin >> val >> type; if(type == 1){ s1.insert(val); } else { s2.insert(val); } vector <int> v1, v2; for(auto i : s1) v1.push_back(i); for(auto i : s2) v2.push_back(i); int pos = 0; bool ok = 1; for(int i = 0; i < v1.size(); i ++){ while(pos < v2.size() && v2[pos] < v1[i]) pos ++; if(pos >= v2.size()){ ok = 0; break; } pos ++; } if(ok){ puts("<"); continue; } pos = 0; ok = 1; for(int i = 0; i < v2.size(); i ++){ while(pos < v1.size() && v1[pos] < v2[i]) pos ++; if(pos >= v1.size()){ ok = 0; break; } pos ++; } if(ok || v1.empty()){ puts(">"); } else { puts("?"); } } }

Compilation message (stderr)

stones.cpp: In function 'int main()':
stones.cpp:26:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int i = 0; i < v1.size(); i ++){
                            ~~^~~~~~~~~~~
stones.cpp:27:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   while(pos < v2.size() && v2[pos] < v1[i])
                         ~~~~^~~~~~~~~~~
stones.cpp:29:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   if(pos >= v2.size()){
                      ~~~~^~~~~~~~~~~~
stones.cpp:41:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int i = 0; i < v2.size(); i ++){
                            ~~^~~~~~~~~~~
stones.cpp:42:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   while(pos < v1.size() && v1[pos] < v2[i])
                         ~~~~^~~~~~~~~~~
stones.cpp:44:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                   if(pos >= v1.size()){
                      ~~~~^~~~~~~~~~~~
stones.cpp:9:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
       scanf("%d", &q);
       ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...