Submission #709813

# Submission time Handle Problem Language Result Execution time Memory
709813 2023-03-14T13:31:11 Z Dan4Life Remittance (JOI19_remittance) C++17
0 / 100
2 ms 2680 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define int long long
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
const int mxN = (int)1e5+10;
const int LINF = (int)1e18;
int n, m, x, y;
vector<int> adj[mxN];
int a[mxN], b[mxN], c[mxN];

int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i] >> b[i], c[i]=a[i];
    for(int i = 1; i <= n; i++){
        int xd = n, ok = 1;
        for(int i = 1; i <= n; i++) c[i]=a[i];
        for(int j = i; xd-- and ok; j++){
            if(j==n+1) j=1;
            int extra = c[j]-b[j];
            if(extra%2 or extra<0) ok=0;
            int nx = j+1; if(nx>n)nx=1;
            c[nx]+=extra/2, c[j]=b[j];
        }
        for(int j = 1; j <= n; j++)
            if(c[j]!=b[j]) ok=0;
        if(ok){cout << "Yes";return 0;}
    }
    cout << "No";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2676 KB Output is correct
3 Correct 2 ms 2580 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2680 KB Output is correct
8 Incorrect 2 ms 2672 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2676 KB Output is correct
3 Correct 2 ms 2580 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2680 KB Output is correct
8 Incorrect 2 ms 2672 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2676 KB Output is correct
3 Correct 2 ms 2580 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2680 KB Output is correct
8 Incorrect 2 ms 2672 KB Output isn't correct
9 Halted 0 ms 0 KB -