Submission #17889

#TimeUsernameProblemLanguageResultExecution timeMemory
17889ErzhannWeighting stones (IZhO11_stones)C++98
Compilation error
0 ms0 KiB
/* /\ /\ | ).|.( | | >-< | ========= It's Adilkhan99 miaaaaaau */ #include<bits/stdc++.h> #define ll long long #define pb push_back #define endl "\n" #define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++) #define mp make_pair #define f first #define s second #define name "" #define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); using namespace std; const int MaxN = int (2e5) + 256; const int INF = int(1e9); const int mod = (int)(1e9) + 7; int n, a[MaxN], m, t; set<int> s, S; bool u[MaxN], U[MaxN]; int main () { scanf("%d", &n); for(int i = 1; i <= n; ++i){ int x, y; scanf("%d%d", &x, &y); if(y == 2){ if(!u[x]){ S.insert(-x); U[x] = 1; }else{ s.erase(-x); u[x] = 0; } } else{ if(!U[x]){ s.insert(-x); u[x] = 1; }else{ S.erase(-x); U[x] = 0; } } auto I = s.begin(); auto J = S.begin(); bool ok = 0, ok1 = 0; if(s.size() > S.size()) ok = 1; if(S.size() > s.size()) ok1 = 1; while(I != s.end() && J != S.end()){ if(ok && ok1){ break; } if(-(*I) > -(*J)) ok = 1; if(-(*I) < -(*J)) ok1 = 1; I++; J++; } if(ok && ok1) puts("?"); else if(ok) puts(">"); else puts("<"); } return 0; }

Compilation message (stderr)

stones.cpp: In function ‘int main()’:
stones.cpp:51:9: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
         auto I = s.begin();
         ^
stones.cpp:51:14: error: ‘I’ does not name a type
         auto I = s.begin();
              ^
stones.cpp:52:9: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
         auto J = S.begin();
         ^
stones.cpp:52:14: error: ‘J’ does not name a type
         auto J = S.begin();
              ^
stones.cpp:58:15: error: ‘I’ was not declared in this scope
         while(I != s.end() && J != S.end()){
               ^
stones.cpp:58:31: error: ‘J’ was not declared in this scope
         while(I != s.end() && J != S.end()){
                               ^
stones.cpp:30:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
stones.cpp:32:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         int x, y; scanf("%d%d", &x, &y);
                                        ^