Submission #677739

# Submission time Handle Problem Language Result Execution time Memory
677739 2023-01-04T09:17:05 Z benedict0724 Remittance (JOI19_remittance) C++17
0 / 100
1 ms 212 KB
#include <iostream>
#include <stack>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;
typedef long long ll;

ll A[22], B[22], C[22];

int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL);
    int N; cin >> N;
    for(int i=0;i<N;i++) cin >> A[i] >> B[i];
    for(int i=0;i<N;i++) C[i] = B[i] - A[i];
    
    ll X = (1<<N) - 1;
    bool flag = true;
    for(int i=0;i<N;i++)
    {
        ll tmp = 0;
        for(int j=0;j<N;j++)
        {
            tmp += (1<<j) * C[(i+j)%N];
        }
        if(tmp < 0 || tmp%X != 0) flag = false;
    }
    if(flag) cout << "Yes\n";
    else cout << "No\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -