Submission #1093052


Source Code Expand

#include <bits/stdc++.h>

#define N (1<<17)
#define ll long long
#define ld long double
#define M 1000000007
#define INF 1000000007
#define LINF 1000000000000000007LL
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pb push_back
#define F first
#define S second
#define L length() - 1

using namespace std;

int main () {
    ll n;
    cin>>n;
    ll s = 0;
    ll v[n];
    for (int i = 0; i < n; i++) {
        cin>>v[i];
        s += v[i];
    }
    if (s % (n * (n + 1) / 2)) {
        cout<<"NO"<<endl;
        return 0;
    }
    ll t = s / (n * (n + 1) / 2);
    for (ll i = 0; i < n; i++) {
        v[i] -= t * (i + 1);
        v[i] %= n;
        v[i] += n;
        v[i] %= n;
    }
    bool b = true;
    for (int i = 1; i < n; i++) {
        b = b & (v[i] == v[i - 1]);
    }
    if (b) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Submission Info

Submission Time
Task B - Boxes
User Kuha
Language C++14 (GCC 5.4.1)
Score 0
Code Size 912 Byte
Status WA
Exec Time 71 ms
Memory 1024 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 25
WA × 5
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in2.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt
Case Name Status Exec Time Memory
in1.txt AC 43 ms 1024 KB
in10.txt AC 9 ms 256 KB
in11.txt WA 70 ms 1024 KB
in12.txt WA 70 ms 1024 KB
in13.txt WA 59 ms 896 KB
in14.txt AC 3 ms 256 KB
in15.txt AC 2 ms 256 KB
in16.txt AC 3 ms 256 KB
in17.txt AC 3 ms 256 KB
in18.txt AC 3 ms 256 KB
in19.txt AC 3 ms 256 KB
in2.txt AC 64 ms 1024 KB
in20.txt AC 3 ms 256 KB
in21.txt AC 67 ms 1024 KB
in22.txt AC 58 ms 1024 KB
in23.txt AC 57 ms 1024 KB
in24.txt AC 5 ms 256 KB
in25.txt AC 8 ms 256 KB
in26.txt WA 69 ms 1024 KB
in27.txt WA 69 ms 1024 KB
in3.txt AC 65 ms 1024 KB
in4.txt AC 69 ms 1024 KB
in5.txt AC 71 ms 1024 KB
in6.txt AC 66 ms 1024 KB
in7.txt AC 66 ms 1024 KB
in8.txt AC 8 ms 256 KB
in9.txt AC 9 ms 256 KB
sample1.txt AC 3 ms 256 KB
sample2.txt AC 3 ms 256 KB
sample3.txt AC 3 ms 256 KB