Submission #1093040
Source Code Expand
#include <iostream> #include <map> #include <vector> #include <algorithm> using namespace std; int main() { int n; cin >> n; int a[n]; for(int i = 0; i < n; i++){ cin >> a[i]; } bool isAllZero = false; bool isIll = false; while(!isAllZero && !isIll){ int max = -1; int maxpos = -1; for(int i = 0; i < n; i++){ if(max < a[i]){ max = a[i]; maxpos = i; } } for(int i = 0; i < n; i++){ a[(i + maxpos+1) % n] -= i+1; } // for(int i = 0; i < n; i++){ // cout << a[i] << ","; // } // cout << endl; isAllZero = true; for(int i = 0; i < n; i++){ if(a[i] != 0){ isAllZero = false; } if(a[i] < 0){ isIll = true; } } } if(isIll){ cout << "NO" << endl; }else{ cout << "YES" << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Boxes |
User | sssbear |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 836 Byte |
Status | TLE |
Exec Time | 2102 ms |
Memory | 640 KB |
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 | 43 ms | 640 KB |
in10.txt | AC | 1971 ms | 256 KB |
in11.txt | TLE | 2102 ms | 640 KB |
in12.txt | TLE | 2102 ms | 640 KB |
in13.txt | AC | 696 ms | 512 KB |
in14.txt | AC | 2 ms | 256 KB |
in15.txt | TLE | 2102 ms | 256 KB |
in16.txt | TLE | 2102 ms | 256 KB |
in17.txt | TLE | 2102 ms | 256 KB |
in18.txt | TLE | 2102 ms | 256 KB |
in19.txt | AC | 2 ms | 256 KB |
in2.txt | TLE | 2102 ms | 640 KB |
in20.txt | AC | 2 ms | 256 KB |
in21.txt | AC | 47 ms | 640 KB |
in22.txt | AC | 47 ms | 640 KB |
in23.txt | AC | 47 ms | 640 KB |
in24.txt | AC | 452 ms | 256 KB |
in25.txt | AC | 1266 ms | 256 KB |
in26.txt | AC | 938 ms | 640 KB |
in27.txt | TLE | 2064 ms | 640 KB |
in3.txt | TLE | 2102 ms | 640 KB |
in4.txt | TLE | 2102 ms | 640 KB |
in5.txt | TLE | 2102 ms | 640 KB |
in6.txt | AC | 1909 ms | 640 KB |
in7.txt | TLE | 2102 ms | 640 KB |
in8.txt | AC | 442 ms | 256 KB |
in9.txt | TLE | 2102 ms | 256 KB |
sample1.txt | AC | 2 ms | 256 KB |
sample2.txt | AC | 2 ms | 256 KB |
sample3.txt | AC | 3 ms | 256 KB |