Submission #253788

# Submission time Handle Problem Language Result Execution time Memory
253788 2020-07-28T17:12:38 Z kshitij_sodani Remittance (JOI19_remittance) C++14
Compilation error
0 ms 0 KB

#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first 
#define b second
llo n;
pair<llo,llo> it[1000001];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;

	int tt=1;
	for(llo i=0;i<n;i++){
		cin>>it[i].a>>it[i].b;
	}
	for(int i=0;i<70;i++){
		for(int j=0;j<n;j++){
			if(it[j].a>it[j].b){
				int x=(it[j].a-it[j].b+1)/2;
				if(it[j].a-x*2<0){
					x-=1;
				}
				it[j].a-=x*2;
				it[(j+1)%n]+=x;
			}
		}
	}
	for(int i=0;i<n;i++){
		if(it[i].a!=it[i].b){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;



	return 0;
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:29:16: error: no match for 'operator+=' (operand types are 'std::pair<long long int, long long int>' and 'int')
     it[(j+1)%n]+=x;
     ~~~~~~~~~~~^~~
remittance.cpp:17:6: warning: unused variable 'tt' [-Wunused-variable]
  int tt=1;
      ^~