結果
問題 |
No.61 リベリオン
|
ユーザー |
|
提出日時 | 2020-02-28 00:49:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 635 bytes |
コンパイル時間 | 705 ms |
コンパイル使用メモリ | 65,448 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-13 16:11:05 |
合計ジャッジ時間 | 1,297 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 1 WA * 3 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; int Q; bool vis[4][16][16]; int X,Y,D,Mx,My,Hx,Hy,Vx,Vy; main() { cin>>Q; for(;Q--;) { cin>>X>>Y>>D>>Mx>>My>>Hx>>Hy>>Vx>>Vy; for(int r=0;r<4;r++)for(int i=0;i<=X;i++)for(int j=0;j<=Y;j++)vis[r][i][j]=false; int x=Hx,y=Hy,r=0; for(;D--&&!vis[r][x][y];) { vis[r][x][y]=true; x+=r&1?-Vx:Vx; y+=r&2?-Vy:Vy; while(x<0||x>X) { if(x<0)x=-x,r^=1; else if(x>X)x=X-(x-X),r^=1; } while(y<0||y>Y) { if(y<0)y=-y,r^=2; else if(y>Y)y=Y-(y-Y),r^=2; } } bool ans=false; for(int r=0;r<4;r++)ans|=vis[r][Mx][My]; cout<<(ans?"Hit":"Miss")<<endl; } }