Submission #778914

#TimeUsernameProblemLanguageResultExecution timeMemory
778914shoryu386Remittance (JOI19_remittance)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long main(){ int n; cin >> n; int a[n], b[n]; for (int x = 0;x < n; x++) cin >> a[x] >> b[x]; #define SUS 40000 for (int y = 0; y < SUS; y++){ for (int x = 0; x < n; x++){ if (a[x] >= b[x] + 2){ int trans = (a[x] - b[x])/2; a[x] -= 2*trans; if (x != n-1) a[x+1] += trans; else a[0] += trans; } } } bool wtf = true; for (int x = 0; x < n; x++){ //if (a[x] >= b[x] + 2) assert(false); if (a[x] != b[x]) wtf = false; } if (wtf) cout << "Yes"; else assert(n != 2), cout << "No"; } #include <bits/stdc++.h> using namespace std; #define int long long main(){ int n; cin >> n; int a[n], b[n]; for (int x = 0;x < n; x++) cin >> a[x] >> b[x]; #define SUS 40000 for (int y = 0; y < SUS; y++){ for (int x = 0; x < n; x++){ if (a[x] >= b[x] + 2){ int trans = (a[x] - b[x])/2; a[x] -= 2*trans; if (x != n-1) a[x+1] += trans; else a[0] += trans; } } } bool wtf = true; for (int x = 0; x < n; x++){ //if (a[x] >= b[x] + 2) assert(false); if (a[x] != b[x]) wtf = false; } if (wtf) cout << "Yes"; else { if (n == 2){ if (a[0] == b[0] + 1 && a[1] == b[1] + 1) { cout << "Yes"; return 0;} assert(false); } cout << "No"; } }

Compilation message (stderr)

remittance.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
remittance.cpp:38:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   38 | main(){
      | ^~~~
remittance.cpp:38:1: error: redefinition of 'int main()'
remittance.cpp:6:1: note: 'int main()' previously defined here
    6 | main(){
      | ^~~~