# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
14183 |
2015-05-03T09:22:09 Z |
ainu7 |
볼질 (OJUZ10_ballparade) |
C++ |
|
12 ms |
1716 KB |
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;
int main()
{
int N;
cin >> N;
int res = 0;
int b1 = 0, b2 = 0, b3 = 0;
int cnt = 0;
for (int i=0; i<N; i++) {
int type;
cin >> type;
if (type == 1) {
cnt ++;
if (cnt == 4) {
cnt = 0;
type = 2;
}
}
if (type == 2) {
cnt = 0;
b1 ++;
if (b1 == 2) {
b1 --;
b2 ++;
if (b2 == 2) {
b2 --;
b3 ++;
if (b3 == 2) {
b3 --;
res ++;
}
}
}
}
if (type == 3) {
res += b3;
b3 = b2;
b2 = b1;
b1 = 0;
cnt ++;
if (cnt == 4) {
b1 = 1;
cnt = 0;
}
}
}
cout << res << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1716 KB |
Output is correct |
2 |
Correct |
0 ms |
1716 KB |
Output is correct |
3 |
Correct |
0 ms |
1716 KB |
Output is correct |
4 |
Correct |
11 ms |
1716 KB |
Output is correct |
5 |
Correct |
0 ms |
1716 KB |
Output is correct |
6 |
Correct |
7 ms |
1716 KB |
Output is correct |
7 |
Correct |
0 ms |
1716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1716 KB |
Output is correct |
2 |
Correct |
11 ms |
1716 KB |
Output is correct |
3 |
Correct |
0 ms |
1716 KB |
Output is correct |
4 |
Correct |
3 ms |
1716 KB |
Output is correct |
5 |
Correct |
0 ms |
1716 KB |
Output is correct |
6 |
Correct |
0 ms |
1716 KB |
Output is correct |
7 |
Correct |
12 ms |
1716 KB |
Output is correct |
8 |
Correct |
0 ms |
1716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1716 KB |
Output is correct |
2 |
Correct |
12 ms |
1716 KB |
Output is correct |
3 |
Correct |
0 ms |
1716 KB |
Output is correct |
4 |
Correct |
0 ms |
1716 KB |
Output is correct |
5 |
Correct |
12 ms |
1716 KB |
Output is correct |
6 |
Correct |
12 ms |
1716 KB |
Output is correct |
7 |
Correct |
5 ms |
1716 KB |
Output is correct |
8 |
Correct |
12 ms |
1716 KB |
Output is correct |
9 |
Correct |
6 ms |
1716 KB |
Output is correct |
10 |
Correct |
12 ms |
1716 KB |
Output is correct |
11 |
Correct |
12 ms |
1716 KB |
Output is correct |
12 |
Correct |
11 ms |
1716 KB |
Output is correct |
13 |
Correct |
12 ms |
1716 KB |
Output is correct |
14 |
Correct |
0 ms |
1716 KB |
Output is correct |
15 |
Correct |
0 ms |
1716 KB |
Output is correct |