結果
問題 |
No.511 落ちゲー 〜手作業のぬくもり〜
|
ユーザー |
![]() |
提出日時 | 2017-04-29 00:08:31 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 913 bytes |
コンパイル時間 | 290 ms |
コンパイル使用メモリ | 23,936 KB |
実行使用メモリ | 14,016 KB |
最終ジャッジ日時 | 2024-09-13 18:50:09 |
合計ジャッジ時間 | 14,899 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 27 TLE * 1 -- * 4 |
コンパイルメッセージ
main.cpp: In function ‘int solve()’: main.cpp:23:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | scanf("%d%d%d", &a, &b, &x); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<cstdio> #include<cstring> typedef long long ll; int n, w; ll h; ll bh[100000+1]; int solve(void) { int a, b, x, i, j, ret=-1, rest; int score[2]={0, 0}; rest=w; memset(bh, 0, sizeof(bh)); for(i=0;i<n;i++) { scanf("%d%d%d", &a, &b, &x); // if(ret>=0) continue; for(j=0;j<a;j++) { if(bh[x+j]<h) { bh[x+j]+=b; if(bh[x+j]>=h) { score[i%2]++; rest--; if(!rest) { if(score[0]==score[1]) ret=0; if(score[0]>score[1]) ret=1; if(score[0]<score[1]) ret=2; return ret; } } } } } /* printf("n=%d w=%d h=%lld\n", n, w, h); printf("score=(%d,%d) ret=%d\n", score[0], score[1], ret); for(j=1;j<=w;j++) printf("%lld ", bh[j]); printf("\n"); */ return ret; } int main(void) { char result[][5]={"DRAW", "A", "B"}; while(scanf("%d%d%lld", &n, &w, &h)==3) { printf("%s\n", result[solve()]); break; } return 0; }