Submission #1093054
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<b;i++) typedef long long ll; int N; ll A[101010]; //----------------------------------------------------------------- ll d[101010]; bool sol() { rep(i, 0, N) { int j = (i + 1) % N; d[i] = A[j] - A[i]; } ll n = -(1LL<<60); rep(i, 0, N) n = max(n, d[i]); if (n < 0) return false; if (n == 0) { rep(i, 0, N) if (d[i] != 0) return false; return true; } ll sm = 0; rep(i, 0, N) { ll up = n - d[i]; if (up < 0) return false; if (up % 5) return false; sm += up / 5; } return sm == n; } //----------------------------------------------------------------- int main() { cin >> N; rep(i, 0, N) scanf("%lld", &A[i]); if (sol()) printf("YES\n"); else printf("NO\n"); }
Submission Info
Submission Time | |
---|---|
Task | B - Boxes |
User | hamayanhamayan |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 825 Byte |
Status | WA |
Exec Time | 16 ms |
Memory | 1792 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:42:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] rep(i, 0, N) 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 | WA | 15 ms | 1792 KB |
in10.txt | AC | 4 ms | 384 KB |
in11.txt | AC | 16 ms | 1792 KB |
in12.txt | AC | 16 ms | 1792 KB |
in13.txt | AC | 14 ms | 1536 KB |
in14.txt | AC | 2 ms | 256 KB |
in15.txt | AC | 2 ms | 256 KB |
in16.txt | WA | 2 ms | 256 KB |
in17.txt | WA | 2 ms | 256 KB |
in18.txt | WA | 2 ms | 256 KB |
in19.txt | AC | 3 ms | 256 KB |
in2.txt | WA | 16 ms | 1792 KB |
in20.txt | AC | 2 ms | 256 KB |
in21.txt | AC | 16 ms | 1792 KB |
in22.txt | AC | 16 ms | 1792 KB |
in23.txt | AC | 16 ms | 1792 KB |
in24.txt | AC | 3 ms | 384 KB |
in25.txt | AC | 4 ms | 384 KB |
in26.txt | AC | 16 ms | 1792 KB |
in27.txt | AC | 16 ms | 1792 KB |
in3.txt | WA | 16 ms | 1792 KB |
in4.txt | WA | 16 ms | 1792 KB |
in5.txt | WA | 16 ms | 1792 KB |
in6.txt | AC | 16 ms | 1792 KB |
in7.txt | AC | 16 ms | 1792 KB |
in8.txt | AC | 4 ms | 384 KB |
in9.txt | AC | 4 ms | 384 KB |
sample1.txt | AC | 2 ms | 256 KB |
sample2.txt | AC | 2 ms | 256 KB |
sample3.txt | AC | 3 ms | 256 KB |