Submission #17840

# Submission time Handle Problem Language Result Execution time Memory
17840 2016-01-12T12:13:46 Z Erzhann Weighting stones (IZhO11_stones) C++
Compilation error
0 ms 0 KB
/*
  /\     /\
  | ).|.( |
  |  >-<  |
  =========
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(0);

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;
multiset<int> s, S;

int main () { _

	cin >> n;
	for(int i = 1; i <= n; i++){
		int x, y; cin >> x >> y;
		if(y == 2)
			S.insert(-x);		
		else s.insert(-x);
		auto I = s.begin();
		auto J = S.begin();
		bool ok = 0, ok1 = 0;
		while(I != s.end() && J != S.end()){
			if(ok && ok1){
				break;
			}
			if(-(*I) > -(*J))
				ok = 1;
			if(-(*I) < -(*J))
				ok1 = 1;
			I++;
			J++;
		}
		if(I == s.end() && J != S.end())
			ok1 = 1;
		if(J == S.end() && I != s.end())
			ok = 1;
		if(ok && ok1)
			cout << "?";
		else if(ok)
			cout << ">";
		else cout << "<";
		cout << endl;								
	}	              	
return 0;
}                   									

Compilation message

stones.cpp: In function ‘int main()’:
stones.cpp:36:3: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
   auto I = s.begin();
   ^
stones.cpp:36:8: error: ‘I’ does not name a type
   auto I = s.begin();
        ^
stones.cpp:37:3: warning: ‘auto’ changes meaning in C++11; please remove it [-Wc++0x-compat]
   auto J = S.begin();
   ^
stones.cpp:37:8: error: ‘J’ does not name a type
   auto J = S.begin();
        ^
stones.cpp:39:9: error: ‘I’ was not declared in this scope
   while(I != s.end() && J != S.end()){
         ^
stones.cpp:39:25: error: ‘J’ was not declared in this scope
   while(I != s.end() && J != S.end()){
                         ^
stones.cpp:50:6: error: ‘I’ was not declared in this scope
   if(I == s.end() && J != S.end())
      ^
stones.cpp:50:22: error: ‘J’ was not declared in this scope
   if(I == s.end() && J != S.end())
                      ^
stones.cpp:52:6: error: ‘J’ was not declared in this scope
   if(J == S.end() && I != s.end())
      ^
stones.cpp:52:22: error: ‘I’ was not declared in this scope
   if(J == S.end() && I != s.end())
                      ^