Submission #521903

# Submission time Handle Problem Language Result Execution time Memory
521903 2022-02-03T12:12:22 Z DanerZein Labels (NOI20_labels) C++14
0 / 100
82 ms 5620 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int n; cin>>n;
  vector<int> x;
  for(int i=0;i<n-1;i++){
    int a; cin>>a;
    x.push_back(a);
  }
  vector<int> res;
  res.push_back(1);
  for(int i=0;i<n-1;i++){
    res.push_back(res[i]+x[i]);
  }
  int mi=1e9,ma=-1;
  for(int i=0;i<n;i++){
    mi=min(res[i],mi);
  }
  if(mi<0){
    for(int i=0;i<n;i++){
      res[i]-=(mi-1);
    }
  }
  for(int i=0;i<n;i++){
    ma=max(ma,res[i]);
  }
  if(ma!=n) cout<<"-1\n";
  else{
    for(int i=0;i<n;i++) cout<<res[i]<<" ";
    cout<<endl;
  }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 288 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 288 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 288 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 70 ms 5340 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 82 ms 5620 KB Output is correct
4 Correct 48 ms 5080 KB Output is correct
5 Correct 49 ms 5168 KB Output is correct
6 Correct 47 ms 5260 KB Output is correct
7 Correct 43 ms 5072 KB Output is correct
8 Correct 49 ms 5168 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Incorrect 0 ms 204 KB Output isn't correct
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 288 KB Output isn't correct
3 Halted 0 ms 0 KB -