제출 #167375

#제출 시각아이디문제언어결과실행 시간메모리
167375L01Miners (IOI07_miners)C++17
100 / 100
276 ms100960 KiB
#include <iostream> using namespace std; int tablapd[100005][4][4][4][4],tletras,letras[100005]; char letra; int costo(int n1,int n2,int n3) { if(n1==0 and n2==0) return 1; if(n1==0 and n2!=n3) return 2; if(n1==0 and n2==n3) return 1; if(n2==0 and n1!=n3) return 2; if(n2==0 and n1==n3) return 1; if(n1==n2 and n2==n3) return 1; if((n1==n2 and n1!=n3) or (n1==n3 and n1!=n2) or (n2==n3 and n1!=n2)) return 2; if(n1!=n2 and n1!=n3 and n2!=n3) return 3; } int main() { cin>>tletras; for(int i=1;i<=tletras;i++) { cin>>letra; if(letra=='M') letras[i]=1; if(letra=='B') letras[i]=2; if(letra=='F') letras[i]=3; } for(int i=tletras-1;i>=0;i--) { for(int a=0;a<=3;a++) { for(int b=0;b<=3;b++) { for(int c=0;c<=3;c++) { for(int d=0;d<=3;d++) { int e=letras[i+1]; tablapd[i][a][b][c][d]=max(tablapd[i+1][b][e][c][d]+costo(a,b,e),tablapd[i+1][a][b][d][e]+costo(c,d,e)); } } } } } cout<<tablapd[0][0][0][0][0]; return 0; }

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

miners.cpp: In function 'int costo(int, int, int)':
miners.cpp:23:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...