제출 #258207

#제출 시각아이디문제언어결과실행 시간메모리
258207cheehengRestore Array (RMI19_restore)C++14
7 / 100
14 ms512 KiB
#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; }

컴파일 시 표준 에러 (stderr) 메시지

restore.cpp: In function 'int main()':
restore.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &M);
     ~~~~~^~~~~~~~~~~~~~~~
restore.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d%d", &l[i], &r[i], &k[i], &value[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...