답안 #796145

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
796145 2023-07-28T07:02:29 Z 이동현(#10071) Security Guard (JOI23_guard) C++17
0 / 100
10 ms 1876 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define int long long
using namespace std;

int dp[1004];

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, m, q;
    cin >> n >> m >> q;
    vector<int> a(n);
    int ans = 0;
    for(int i = 0; i < n; ++i){
        cin >> a[i];

        if(i && a[i] == a[i - 1]){
            ans += a[i];
        }
    }

    for(int rep = 1; rep <= 2; ++rep){
        int chk = 0;
        for(int i = 0; i < n; ++i){
            if(a[i] >= rep){
                if(i && !chk) ++ans;
                chk = 1;

                int j = i;
                while(j + 1 < n && a[j + 1] >= rep){
                    ++j;
                }

                i = j;

                if(i + 1 < n){
                    ++ans;
                }
            }
        }
    }

    cout << ans << '\n';
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 1876 KB Output is correct
4 Incorrect 10 ms 1876 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 1876 KB Output is correct
4 Incorrect 10 ms 1876 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 1876 KB Output is correct
4 Incorrect 10 ms 1876 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 1876 KB Output is correct
4 Incorrect 10 ms 1876 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 8 ms 1876 KB Output is correct
3 Correct 8 ms 1876 KB Output is correct
4 Incorrect 10 ms 1876 KB Output isn't correct
5 Halted 0 ms 0 KB -