답안 #631902

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
631902 2022-08-19T05:42:33 Z radal Lamps (JOI19_lamps) C++17
4 / 100
17 ms 19880 KB
#include <bits/stdc++.h>
#define rep(i,l,r) for (int i = l; i < r; i++)
#define pb push_back
#define debug(x) cerr << #x << " : " << x << endl;

using namespace std;

constexpr int N = 1e6+10;

int dp[N],l[N][3];

int main(){
    ios_base :: sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    s = '#'+s;
    t = '#'+t;
    rep(i,1,n+1){
        if (s[i] != t[i]) l[i][2] = 1+l[i-1][2];
        else l[i][2] = 0;
        if (t[i] == '1') l[i][1] = l[i-1][1]+1;
        else l[i][0] = l[i-1][0]+1;
        if (s[i] == t[i]){
            dp[i] = dp[i-1];
            continue;
        }
        dp[i] = dp[i-max({l[i][1],l[i][0],l[i][2]})]+1;
    }
    cout << dp[n];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 328 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Incorrect 1 ms 212 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 328 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Incorrect 1 ms 212 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 14 ms 19828 KB Output is correct
8 Correct 15 ms 19860 KB Output is correct
9 Correct 15 ms 19860 KB Output is correct
10 Correct 15 ms 19880 KB Output is correct
11 Correct 17 ms 19828 KB Output is correct
12 Correct 15 ms 19828 KB Output is correct
13 Correct 15 ms 19856 KB Output is correct
14 Correct 14 ms 19848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 328 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Incorrect 1 ms 212 KB Output isn't correct
14 Halted 0 ms 0 KB -