# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
528250 |
2022-02-19T18:20:54 Z |
rainboy |
Izbori (COCI22_izbori) |
C |
|
3000 ms |
656 KB |
#include <stdio.h>
#define N 200000
int main() {
static int aa[N];
int n, i, l, r, a, k, k_, cnt;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &aa[i]);
cnt = 0;
for (l = 0; l < n; l++) {
a = 0, k = 0;
for (r = l; r < n; r++) {
if (k == 0)
a = aa[r], k++;
else if (a == aa[r])
k++;
else
k--;
k_ = 0;
for (i = l; i <= r; i++)
if (aa[i] == a)
k_++;
else
k_--;
if (k_ > 0)
cnt++;
}
}
printf("%d\n", cnt);
return 0;
}
Compilation message
Main.c: In function 'main':
Main.c:9:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
9 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
Main.c:11:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
11 | scanf("%d", &aa[i]);
| ^~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
260 KB |
Output is correct |
3 |
Correct |
4 ms |
204 KB |
Output is correct |
4 |
Correct |
5 ms |
204 KB |
Output is correct |
5 |
Correct |
4 ms |
204 KB |
Output is correct |
6 |
Correct |
4 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
260 KB |
Output is correct |
3 |
Correct |
4 ms |
204 KB |
Output is correct |
4 |
Correct |
5 ms |
204 KB |
Output is correct |
5 |
Correct |
4 ms |
204 KB |
Output is correct |
6 |
Correct |
4 ms |
204 KB |
Output is correct |
7 |
Correct |
99 ms |
280 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
981 ms |
276 KB |
Output is correct |
10 |
Correct |
978 ms |
268 KB |
Output is correct |
11 |
Correct |
980 ms |
272 KB |
Output is correct |
12 |
Correct |
977 ms |
268 KB |
Output is correct |
13 |
Correct |
979 ms |
268 KB |
Output is correct |
14 |
Correct |
973 ms |
268 KB |
Output is correct |
15 |
Correct |
996 ms |
268 KB |
Output is correct |
16 |
Correct |
975 ms |
204 KB |
Output is correct |
17 |
Correct |
966 ms |
272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3052 ms |
656 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
260 KB |
Output is correct |
3 |
Correct |
4 ms |
204 KB |
Output is correct |
4 |
Correct |
5 ms |
204 KB |
Output is correct |
5 |
Correct |
4 ms |
204 KB |
Output is correct |
6 |
Correct |
4 ms |
204 KB |
Output is correct |
7 |
Correct |
99 ms |
280 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
981 ms |
276 KB |
Output is correct |
10 |
Correct |
978 ms |
268 KB |
Output is correct |
11 |
Correct |
980 ms |
272 KB |
Output is correct |
12 |
Correct |
977 ms |
268 KB |
Output is correct |
13 |
Correct |
979 ms |
268 KB |
Output is correct |
14 |
Correct |
973 ms |
268 KB |
Output is correct |
15 |
Correct |
996 ms |
268 KB |
Output is correct |
16 |
Correct |
975 ms |
204 KB |
Output is correct |
17 |
Correct |
966 ms |
272 KB |
Output is correct |
18 |
Execution timed out |
3052 ms |
656 KB |
Time limit exceeded |
19 |
Halted |
0 ms |
0 KB |
- |