제출 #168700

#제출 시각아이디문제언어결과실행 시간메모리
168700ho94949Cultivation (JOI17_cultivation)C++17
0 / 100
2 ms504 KiB
#include<bits/stdc++.h> using namespace std; int main() { uint64_t B[40]; int R, C, N; scanf("%d%d%d", &R, &C, &N); for(int i=0; i<N; ++i) { int u, v; scanf("%d%d", &u, &v); B[u-1] |= (1ull<<v-1); } int ans = 202020; for(int w=0; w<C; ++w) for(int e=0; e<C; ++e) for(int n=0; n<R; ++n) for(int s=0; s<R; ++s) { uint64_t A[40]; memcpy(A, B, sizeof A); if(w+e>=C || n+s>=R) continue; for(int i=0; i<w; ++i) for(int j=0; j<R; ++j) A[i] |= A[i]>>1; for(int i=0; i<e; ++i) for(int j=0; j<R; ++j) A[i] |= A[i]<<1; for(int i=0; i<n; ++i) for(int j=0; j<R-1; ++j) A[j] |= A[j+1]; for(int i=0; i<s; ++i) for(int j=R-2; j>=0; --j) A[j+1] |= A[j]; uint64_t tar = (1ull<<C)-1; printf("%d %d %d %d\n", w, e, n, s); for(int i=0; i<R; ++i,puts("")) for(int j=0; j<C; ++j) printf("%d", !!(A[i]&(1<<j))); for(int i=0; i<R; ++i) tar &= A[i]; if(tar == (1ull<<C)-1) ans = min(ans, w+e+n+s); } printf("%d\n", ans); }

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

cultivation.cpp: In function 'int main()':
cultivation.cpp:11:27: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
         B[u-1] |= (1ull<<v-1);
                          ~^~
cultivation.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &R, &C, &N);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
cultivation.cpp:10:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int u, v; scanf("%d%d", &u, &v);
                   ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...