이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |