結果
| 問題 |
No.1121 Social Distancing in Cinema
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-22 21:49:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 933 bytes |
| コンパイル時間 | 457 ms |
| コンパイル使用メモリ | 59,892 KB |
| 実行使用メモリ | 7,752 KB |
| 最終ジャッジ日時 | 2024-06-22 15:34:43 |
| 合計ジャッジ時間 | 5,242 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 WA * 15 |
コンパイルメッセージ
main.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
10 | main()
| ^~~~
ソースコード
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
int N;
int X[3<<17],Y[3<<17];
bool ex[555][555],vis[555][555];
int id[555][555];
main()
{
scanf("%d",&N);
for(int i=0;i<N;i++)
{
scanf("%d%d",&X[i],&Y[i]);
id[X[i]][Y[i]]=i+1;
}
vector<int>ans;
queue<pair<int,int> >Q;
Q.push(make_pair(1,1));
vis[1][1]=true;
while(!Q.empty())
{
int x=Q.front().first,y=Q.front().second;
Q.pop();
if(!ex[x][y]&&id[x][y]!=0)
{
ans.push_back(id[x][y]);
for(int dx=-9;dx<=9;dx++)for(int dy=-9;dy<=9;dy++)
{
if(x+dx>=1&&y+dy>=1&&dx*dx+dy*dy<100)
{
ex[x+dx][y+dy]=true;
}
}
}
if(y<=500&&!vis[x][y+1])
{
vis[x][y+1]=true;
Q.push(make_pair(x,y+1));
}
if(x<=500&&!vis[x+1][y])
{
vis[x+1][y]=true;
Q.push(make_pair(x+1,y));
}
}
printf("%d\n",(int)ans.size());
for(int i=0;i<ans.size();i++)printf("%d%c",ans[i],i+1==ans.size()?'\n':' ');
}