Submission #1092492
Source Code Expand
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
LL BIT[SIZE];
void ins(int x,int v){
for(;x;x-=x&-x)BIT[x]+=v;
}
LL qq(int x){
LL ret=0;
for(;x<SIZE;x+=x&-x)ret+=BIT[x];
return ret;
}
int a[SIZE];
int main(){
DRI(n);
LL sum=0;
REPP(i,1,n+1){
RI(a[i]);
sum+=a[i];
}
LL one_time=(n+1LL)*n/2;
if(sum%one_time)return 0*puts("NO");
LL tt=sum/one_time;
a[0]=a[n];
LL now=0;
REPP(i,1,n+1){
int dif=a[i]-a[i-1];
LL v=(tt-dif);
if(v%n)return 0*puts("NO");
now+=v/n;
}
if(now!=tt)return 0*puts("NO");
return 0*puts("YES");
}
Submission Info
Submission Time
2017-02-04 21:21:43+0900
Task
B - Boxes
User
dreamoon
Language
C++14 (GCC 5.4.1)
Score
0
Code Size
1683 Byte
Status
WA
Exec Time
17 ms
Memory
640 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:41:11: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
DRI(n);
^
./Main.cpp:44:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
RI(a[i]);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
0 / 500
Status
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
15 ms
640 KB
in10.txt
AC
4 ms
256 KB
in11.txt
WA
16 ms
640 KB
in12.txt
WA
16 ms
640 KB
in13.txt
WA
14 ms
512 KB
in14.txt
AC
2 ms
256 KB
in15.txt
AC
3 ms
256 KB
in16.txt
AC
3 ms
256 KB
in17.txt
AC
2 ms
256 KB
in18.txt
AC
2 ms
256 KB
in19.txt
AC
2 ms
256 KB
in2.txt
AC
16 ms
640 KB
in20.txt
AC
2 ms
256 KB
in21.txt
AC
14 ms
640 KB
in22.txt
AC
14 ms
640 KB
in23.txt
AC
14 ms
640 KB
in24.txt
AC
3 ms
256 KB
in25.txt
AC
4 ms
256 KB
in26.txt
WA
16 ms
640 KB
in27.txt
WA
16 ms
640 KB
in3.txt
AC
17 ms
640 KB
in4.txt
AC
17 ms
640 KB
in5.txt
AC
17 ms
640 KB
in6.txt
AC
15 ms
640 KB
in7.txt
AC
14 ms
640 KB
in8.txt
AC
4 ms
256 KB
in9.txt
AC
4 ms
256 KB
sample1.txt
AC
2 ms
256 KB
sample2.txt
AC
3 ms
256 KB
sample3.txt
AC
2 ms
256 KB