제출 #20749

#제출 시각아이디문제언어결과실행 시간메모리
20749eaststarCan polan into space? (OJUZ11_space)C++11
100 / 100
146 ms17404 KiB
#include <stdio.h> int a[200010][3],p[2][200010]; long long D[2][200010]; void f(int t,int n){ if(!n)return; if(p[t][n])printf("%d ",n); f(p[t][n],n-1); if(!p[t][n])printf("%d ",n); } int main(){ int i,j,n; scanf("%d",&n); for(i=1;i<=n;++i){ for(j=0;j<3;++j)scanf("%d",a[i]+j); } D[0][1]=a[1][0],D[1][1]=a[1][1]; for(i=2;i<=n;++i){ for(j=0;j<2;++j){ if(a[i][j]+D[1][i-1]>a[i][j+1]+D[0][i-1])D[j][i]=a[i][j]+D[1][i-1],p[j][i]=1; else D[j][i]=a[i][j+1]+D[0][i-1]; } } printf("%lld\n",D[0][n]); f(0,n); return 0; }

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

space.cpp: In function 'int main()':
space.cpp:12:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
space.cpp:14:43: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         for(j=0;j<3;++j)scanf("%d",a[i]+j);
                                           ^
#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...