# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
256338 | lyc | Lamps (JOI19_lamps) | C++14 | 30 ms | 27860 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define TRACE(x) cerr << #x << " :: " << x << endl
#define _ << " " <<
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(),(x).end()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for (int i=(a);i>=(b);--i)
#define chmin(x,y) x = min(x,y)
const int mxN = 1e6+5;
int N;
string A, B;
int dp[mxN][6];
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >> N >> A >> B;
FOR(x,0,5) dp[N][x] = 0;
RFOR(i,N-1,0){
if (A[i] == B[i]) FOR(x,0,5) dp[i][x] = dp[i+1][0];
else FOR(x,0,5) dp[i][x] = dp[i+1][1] + (x!=1);
if (B[i] == '0') {
chmin(dp[i][0], dp[i+1][2]+1);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |