제출 #64676

#제출 시각아이디문제언어결과실행 시간메모리
64676nvmdavaMiners (IOI07_miners)C++17
100 / 100
328 ms101384 KiB
#include <bits/stdc++.h> using namespace std; int dp[100002][4][4][4][4]; int f(char c){ if(c == 'M'){ return 1; } else if(c == 'B'){ return 2; } else { return 3; } } int mine(int a, int b, int c){ int s = 0; if (a == 1 || b == 1 || c == 1) s++; if (a == 2 || b == 2 || c == 2) s++; if (a == 3 || b == 3 || c == 3) s++; return s; } int main(){ int len, i, w, j, l, m, n, k, t; cin>>len; string s; cin>>s; for(w = 0; w < len; w++){ t = f(s[w]); for(j = 0; j <= 3; j++){ for(l = 0; l <= 3; l++){ for(m = 0; m <= 3; m++){ for(n = 0; n <= 3; n++){ dp[w + 1][l][t][m][n] = max(dp[w + 1][l][t][m][n], dp[w][j][l][m][n] + mine(j, l, t)); dp[w + 1][j][l][n][t] = max(dp[w + 1][j][l][n][t], dp[w][j][l][m][n] + mine(m, n, t)); } } } } } int mx = -1; w = len; for(j = 0; j <= 3; j++){ for(l = 0; l <= 3; l++){ for(m = 0; m <= 3; m++){ for(n = 0; n <= 3; n++){ mx = max(mx, dp[w][j][l][m][n]); } } } } cout<<mx - 6; }

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

miners.cpp: In function 'int main()':
miners.cpp:22:11: warning: unused variable 'i' [-Wunused-variable]
  int len, i, w, j, l, m, n, k, t;
           ^
miners.cpp:22:29: warning: unused variable 'k' [-Wunused-variable]
  int len, i, w, j, l, m, n, k, t;
                             ^
#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...
#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...