Submission #1093577
Source Code Expand
#include<cstdio> #include<cstdlib> #include<cstring> #include<vector> #include<algorithm> #include<queue> using namespace std; int main(void){ long long a[100001]; int b[100000]; for (int i = 0; i < 100000; i++){ a[i] = 0; b[i] = 0; } long long c; long long k; long long s; int p, q; long long n, m; long long x, y, z; c = 0; s = 0; q = 0; scanf("%lld", &n); for (int i = 0; i < n; i++){ scanf("%lld", &a[i]); s = s + a[i]; } s = s * 2; if (s%n != 0)q = 1; s = s / n; if (s % (n + 1) != 0)q = 1; s = s / (n + 1); a[n] = a[0]; k = s; for (int i = 0; i < n; i++){ if (a[i + 1] - a[i] < 0){ x = a[i] - a[i+1]; y = x / n; y++; z = x%n; z = (n - z) % n; c = c + y; if (z != (k%n))q = 1; } else{ if (a[i + 1] - a[i] > k)q = 1; if (a[i + 1] - a[i] != (k%n))q = 1; } } if (s != c)q = 1; if (q==1) printf("NO\n"); else printf("YES\n"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Boxes |
User | ptrs |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 968 Byte |
Status | WA |
Exec Time | 16 ms |
Memory | 896 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:24:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld", &n); ^ ./Main.cpp:26:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%lld", &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 | 13 ms | 896 KB |
in10.txt | AC | 3 ms | 896 KB |
in11.txt | AC | 14 ms | 896 KB |
in12.txt | AC | 14 ms | 896 KB |
in13.txt | AC | 12 ms | 896 KB |
in14.txt | WA | 2 ms | 896 KB |
in15.txt | WA | 2 ms | 896 KB |
in16.txt | AC | 2 ms | 896 KB |
in17.txt | WA | 2 ms | 896 KB |
in18.txt | WA | 2 ms | 896 KB |
in19.txt | AC | 2 ms | 896 KB |
in2.txt | AC | 15 ms | 896 KB |
in20.txt | AC | 2 ms | 896 KB |
in21.txt | AC | 16 ms | 896 KB |
in22.txt | AC | 16 ms | 896 KB |
in23.txt | AC | 16 ms | 896 KB |
in24.txt | AC | 3 ms | 896 KB |
in25.txt | AC | 3 ms | 896 KB |
in26.txt | AC | 14 ms | 896 KB |
in27.txt | AC | 14 ms | 896 KB |
in3.txt | AC | 15 ms | 896 KB |
in4.txt | AC | 15 ms | 896 KB |
in5.txt | AC | 14 ms | 896 KB |
in6.txt | AC | 14 ms | 896 KB |
in7.txt | AC | 15 ms | 896 KB |
in8.txt | AC | 3 ms | 896 KB |
in9.txt | AC | 3 ms | 896 KB |
sample1.txt | AC | 2 ms | 896 KB |
sample2.txt | AC | 2 ms | 896 KB |
sample3.txt | AC | 2 ms | 896 KB |