Submission #776059

# Submission time Handle Problem Language Result Execution time Memory
776059 2023-07-07T09:05:03 Z mdub Remittance (JOI19_remittance) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long LL;
LL power(int n) {  
  if (n == 0) return 1;
  else return 2*(power(n-1));
}

int main () {
  LL n; cin >>n;
  vector<LL> a(n);
  vector<LL> b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  LL need = 0;
  bool ok = true;
  for (int i= 0; i < n - 1; i++) {
    if ((a[i] > b[i])) {
	
	if ((a[i] - b[i]) % 2) {
	  a[i + 1] += (a[i] - b[i] + 1) / 2;
	  if (i + 1 > 50) {
	    ok = false;
	  }
	  need += power(i + 1);
	}
	else {
	  a[i + 1] += (a[i] - b[i]) / 2;
	}
      }
      else if (a[i] < b[i]) {
	if (i + 1 > 50) {
	  ok = false;
	}
	LL p = power(i + 1);
	if (to_string(p).size() + to_string((b[i] - a[i])).size() >= 17) {
	  ok = false;
	}
	need += p*(b[i] - a[i]);
	if (need > LL(1e16)) {
	  ok = false;
	}
      }
    x
  }
  if (a[n-1] - b[n-1] != need) {
    ok = false;
  }
  if (ok) {
    cout << "Yes\n";
  }
  else cout << "No\n";
    
      
      
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:46:5: error: 'x' was not declared in this scope
   46 |     x
      |     ^