# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
258207 | 2020-08-05T14:31:33 Z | cheeheng | Restore Array (RMI19_restore) | C++14 | 14 ms | 512 KB |
#include <bits/stdc++.h> using namespace std; int A[25]; int l[10005]; int r[10005]; int k[10005]; int value[10005]; int main(){ int N, M; scanf("%d%d", &N, &M); bool subtask2 = true; for(int i = 0; i < M; i ++){ scanf("%d%d%d%d", &l[i], &r[i], &k[i], &value[i]); subtask2 &= (k[i] == 1); } if(subtask2){ for(int i = 0; i < M; i ++){ if(value[i] == 1){ for(int k = l[i]; k <= r[i]; k ++){ A[k] = 1; } } } bool boleh = true; for(int i = 0; i < M; i ++){ int cnt0 = 0; for(int j = l[i]; j <= r[i]; j ++){ cnt0 += (A[j] == 0); } if(cnt0 < k[i] && value[i] == 0){ boleh = false; break; }else if(cnt0 >= k[i] && value[i] == 1){ boleh = false; break; } } if(boleh){ for(int i = 0; i < N; i ++){ printf("%d ", A[i]); } printf("\n"); //return 0; }else{ printf("-1\n"); } return 0; } for(int i = 0; i < (1<<N); i ++){ for(int j = 0; j < N; j ++){ A[j] = (i&(1<<j)) != 0; } bool boleh = true; for(int i = 0; i < M; i ++){ int cnt0 = 0; for(int j = l[i]; j <= r[i]; j ++){ cnt0 += (A[j] == 0); } if(cnt0 < k[i] && value[i] == 0){ boleh = false; break; }else if(cnt0 >= k[i] && value[i] == 1){ boleh = false; break; } } if(boleh){ for(int i = 0; i < N; i ++){ printf("%d ", A[i]); } return 0; } } printf("-1"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 14 ms | 384 KB | Output is correct |
6 | Correct | 7 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 9 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 14 ms | 384 KB | Output is correct |
6 | Correct | 7 ms | 384 KB | Output is correct |
7 | Correct | 3 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 9 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Incorrect | 4 ms | 512 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |