# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1008757 |
2024-06-26T17:46:25 Z |
Rolo678 |
Labels (NOI20_labels) |
C++14 |
|
1000 ms |
2140 KB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >>n;
vector<int>d(n);
for(int i = 1;i<n;i++)
{
cin >>d[i];
}
int num = 0;
int ans = 0;
for(int i = 1;i<=n;i++)
{
bool flag = true;
long long k = i;
for(int j = 1;j<n;j++)
{
if(d[j]+k > n || d[j] + k <= 0)
{
flag = false;
break;
}
else
{
k+= d[i];
}
}
num += (flag==true);
if(flag)ans = i;
}
if(num != 1)
{
cout << -1 << '\n';
}
else
{
int k = ans;
//cout << k << ' ';
for(int j:d)
{
k+= j;
cout << k << ' ';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
436 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
436 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
436 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1066 ms |
2140 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
436 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |