제출 #890783

#제출 시각아이디문제언어결과실행 시간메모리
890783Sir_Ahmed_ImranMiners (IOI07_miners)C++17
84 / 100
1561 ms596 KiB
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define nl '\n' #define ff first #define ss second #define ll long long #define append push_back #define all(x) (x).begin(),(x).end() int dp[2][4][4][4][4]; int c(int n,int m,int o){ set<int> s; if(n) s.insert(n); if(m) s.insert(m); if(o) s.insert(o); return s.size(); } void solve(){ char s; int n,m,o,p,q,r; cin>>n; for(int i=0;i<2;i++) for(int j=0;j<4;j++) for(int k=0;k<4;k++) for(int l=0;l<4;l++) for(int t=0;t<4;t++) dp[i][j][k][l][t]=-1e9; dp[0][0][0][0][0]=0; for(int i=0;i<n;i++){ cin>>s; if(s=='M') m=1; if(s=='F') m=2; if(s=='B') m=3; for(int j=0;j<4;j++) for(int k=0;k<4;k++) for(int l=0;l<4;l++) for(int t=0;t<4;t++) dp[(i+1)%2][j][k][l][t]=-1e9; for(int j=0;j<4;j++){ for(int k=0;k<4;k++){ for(int l=0;l<4;l++){ for(int t=0;t<4;t++){ dp[(i+1)%2][k][m][l][t]=max(dp[(i+1)%2][k][m][l][t] ,dp[i%2][j][k][l][t]+c(j,k,m)); dp[(i+1)%2][j][k][t][m]=max(dp[(i+1)%2][j][k][t][m] ,dp[i%2][j][k][l][t]+c(l,t,m)); } } } } } for(int i=o=0;i<4;i++) for(int j=0;j<4;j++) for(int k=0;k<4;k++) for(int l=0;l<4;l++) o=max(o,dp[n%2][i][j][k][l]); cout<<o; } int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); solve(); return 0; }

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

miners.cpp: In function 'void solve()':
miners.cpp:20:15: warning: unused variable 'p' [-Wunused-variable]
   20 |     int n,m,o,p,q,r;
      |               ^
miners.cpp:20:17: warning: unused variable 'q' [-Wunused-variable]
   20 |     int n,m,o,p,q,r;
      |                 ^
miners.cpp:20:19: warning: unused variable 'r' [-Wunused-variable]
   20 |     int n,m,o,p,q,r;
      |                   ^
miners.cpp:46:47: warning: 'm' may be used uninitialized in this function [-Wmaybe-uninitialized]
   46 |                         ,dp[i%2][j][k][l][t]+c(l,t,m));
      |                                              ~^~~~~~~
#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...