제출 #862503

#제출 시각아이디문제언어결과실행 시간메모리
862503JakobZorzMiners (IOI07_miners)C++14
100 / 100
148 ms101600 KiB
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<limits.h> #include<math.h> #include<map> #include<set> #include<unordered_map> #include<unordered_set> #include<iomanip> typedef long long ll; typedef long double ld; using namespace std; const int MOD=1e9+7; //typedef pair<ll,ll>Point; //typedef pair<ll,ll>Line; //#define x first //#define y second int n; string str; int get_val(int a,int b,int c){ if(a==0&&b==0) return 1; if(a==0) return b!=c?2:1; int res=3; if(a==b||b==c||a==c) res=2; if(a==b&&b==c) res=1; return res; } bool dpt[4][4][4][4][100000]; int dp[4][4][4][4][100000]; int get(int m1,int m2,int m3,int m4,int i){ if(i==n) return 0; if(dpt[m1][m2][m3][m4][i]) return dp[m1][m2][m3][m4][i]; int curr=0; if(str[i]=='M') curr=1; if(str[i]=='B') curr=2; if(str[i]=='F') curr=3; int val1=get(m2,curr,m3,m4,i+1); int val2=get_val(m1,m2,curr); int r1=get(m2,curr,m3,m4,i+1)+get_val(m1,m2,curr); int r2=get(m1,m2,m4,curr,i+1)+get_val(m3,m4,curr); dpt[m1][m2][m3][m4][i]=true; dp[m1][m2][m3][m4][i]=max(r1,r2); return max(r1,r2); } int main(){ ios::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL); //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); cin>>n; cin>>str; cout<<get(0,0,0,0,0)<<"\n"; return 0; }

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

miners.cpp: In function 'int get(int, int, int, int, int)':
miners.cpp:56:9: warning: unused variable 'val1' [-Wunused-variable]
   56 |     int val1=get(m2,curr,m3,m4,i+1);
      |         ^~~~
miners.cpp:57:9: warning: unused variable 'val2' [-Wunused-variable]
   57 |     int val2=get_val(m1,m2,curr);
      |         ^~~~
#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...