제출 #1023748

#제출 시각아이디문제언어결과실행 시간메모리
1023748vjudge1JJOOII 2 (JOI20_ho_t2)C++17
0 / 100
4 ms348 KiB
#include <bits/stdc++.h> #pragma GCC optimize("unroll-loops") #pragma GCC target("avx,avx2,fma") #pragma GCC optimize("Ofast") #define pii pair <int, int> #define pb push_back #define pp pop_back #define int int64_t #define sc second #define fr first using namespace std; const int T=1e9+7; signed main() { ios::sync_with_stdio(0); cout.tie(0); cin.tie(0); int n, k, i, j, a, J, O, I, t, mn=T, x, y; string s; bool r, q; cin >> n >> k >> s; a=(1<<n); for (j=1; j<a; j++) { r=1, q=1, x=0, y=0; bitset <4000> b(j); vector <char> v; for (i=0; i<a; i++) { if (b[i]==1) { v.pb(s[i]); if (q) x=i, q=0; else y=i; } } if (int(v.size())!=k*3) continue; for (i=0; i<k; i++) { if (v[i]!='J') { r=0; break; } } for (i=k; i<2*k; i++) { if (v[i]!='O') { r=0; break; } } for (i=2*k; i<3*k; i++) { if (v[i]!='I') { r=0; break; } } // for (auto j: v) { // cout << j; // } // cout << '\n'; // cout << x << ' ' << y << '\n'; if (r) mn=min(y-x-k*3+1, mn); } if (mn==T) cout << -1; else cout << mn; }

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

ho_t2.cpp: In function 'int main()':
ho_t2.cpp:17:21: warning: unused variable 'J' [-Wunused-variable]
   17 |  int n, k, i, j, a, J, O, I, t, mn=T, x, y;
      |                     ^
ho_t2.cpp:17:24: warning: unused variable 'O' [-Wunused-variable]
   17 |  int n, k, i, j, a, J, O, I, t, mn=T, x, y;
      |                        ^
ho_t2.cpp:17:27: warning: unused variable 'I' [-Wunused-variable]
   17 |  int n, k, i, j, a, J, O, I, t, mn=T, x, y;
      |                           ^
ho_t2.cpp:17:30: warning: unused variable 't' [-Wunused-variable]
   17 |  int n, k, i, j, a, J, O, I, t, mn=T, x, y;
      |                              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...