답안 #673590

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
673590 2022-12-21T08:04:15 Z smartmonky 돌 무게 재기 (IZhO11_stones) C++14
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>

#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
//#define int long long

using namespace std;

void fp(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
const int N = 501 * 500;
int cnt[3], mx[3],kol[3];
int chotam[N];
main(){
	//fp("stones");
	int q;
	cin >> q;
	chotam[0] = -1;
	while(q--){
		int r, s;
		cin >> r >> s;
		mx[s] = max(mx[s], r);
		kol[s]++;
		for(int i = r - 1; i >= 0; i--){
			if(chotam[i] != 0 && chotam[i] != s)
				cnt[s]++;
		}
		chotam[r] = s;
		if(kol[1] = kol[2] && cnt[1] == cnt[2] || kol[1] > kol[2] && cnt[2] > cnt[1] || kol[2] > kol[1] && cnt[1] > cnt[2] ){
			cout <<"?";
		}else if(cnt[1] > cnt[2]){
			cout <<">";
		}else
			cout << "<";
		cout << endl;
		
	}
}

Compilation message

stones.cpp:16:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   16 | main(){
      | ^~~~
stones.cpp: In function 'int main()':
stones.cpp:31:22: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   31 |   if(kol[1] = kol[2] && cnt[1] == cnt[2] || kol[1] > kol[2] && cnt[2] > cnt[1] || kol[2] > kol[1] && cnt[1] > cnt[2] ){
      |               ~~~~~~~^~~~~~~~~~~~~~~~~~~
stones.cpp:31:99: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   31 |   if(kol[1] = kol[2] && cnt[1] == cnt[2] || kol[1] > kol[2] && cnt[2] > cnt[1] || kol[2] > kol[1] && cnt[1] > cnt[2] ){
      |                                                                                   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
stones.cpp:31:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   31 |   if(kol[1] = kol[2] && cnt[1] == cnt[2] || kol[1] > kol[2] && cnt[2] > cnt[1] || kol[2] > kol[1] && cnt[1] > cnt[2] ){
      |      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stones.cpp: In function 'void fp(std::string)':
stones.cpp:12:29: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 | void fp(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stones.cpp:12:70: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 | void fp(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
      |                                                               ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -