제출 #94613

#제출 시각아이디문제언어결과실행 시간메모리
94613ahmedie404Timovi (COCI18_timovi)C++14
80 / 80
919 ms2296 KiB
#include <iostream> using namespace std; int ts[200000+9]; int n; int k, m; int main(){ scanf("%d %d %d", &n, &k, &m); int idx=0; bool forw=true; for(int i=0;i<n;i++){ ts[i]=(m>=k)?k:m; m-=(m>=k)?k:m; if(m == 0) break; } int ti = 2, st, en; while(true){ if(m > 0){ if(ti%2 == 0) for(int i=n-2;i>=0;i--){ ts[i]+=(m>=k)?k:m; m-=(m>=k)?k:m; if(m == 0) break; } else for(int i=1;i<n;i++){ ts[i]+=(m>=k)?k:m; m-=(m>=k)?k:m; if(m == 0) break; } ti++; } else break; } for(int i=0;i<n;i++) printf("%d ", ts[i]); return 0; }

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

timovi.cpp: In function 'int main()':
timovi.cpp:13:9: warning: unused variable 'idx' [-Wunused-variable]
     int idx=0;
         ^~~
timovi.cpp:14:10: warning: unused variable 'forw' [-Wunused-variable]
     bool forw=true;
          ^~~~
timovi.cpp:25:17: warning: unused variable 'st' [-Wunused-variable]
     int ti = 2, st, en;
                 ^~
timovi.cpp:25:21: warning: unused variable 'en' [-Wunused-variable]
     int ti = 2, st, en;
                     ^~
timovi.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d", &n, &k, &m);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...