結果
| 問題 |
No.1121 Social Distancing in Cinema
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2020-07-22 21:53:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,134 bytes |
| コンパイル時間 | 3,783 ms |
| コンパイル使用メモリ | 211,072 KB |
| 最終ジャッジ日時 | 2025-01-12 02:37:49 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 WA * 3 RE * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | scanf("%d %d",&X,&Y);
| ~~~~~^~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000002
int main(){
map<pair<int,int>,int> mp;
int N;
cin>>N;
vector<vector<int>> ind(501,vector<int>(501,-1));
deque<pair<int,int>> P(N);
for(int i=0;i<N;i++){
int X,Y;
scanf("%d %d",&X,&Y);
X++;
Y++;
ind[X][Y] = i;
P[i].first=X;
P[i].second=Y;
}
sort(P.begin(),P.end());
vector<int> ans;
while(P.size()!=0){
if((N+89)/90 <= ans.size())break;
pair<int,int> T;
if(P.size()%2==0){
T = P.back();
P.pop_back();
}
else{
T = P.front();
P.pop_front();
}
if(ind[T.first][T.second]==-1){
continue;
}
ans.push_back(ind[T.first][T.second]);
ind[T.first][T.second]=-1;
int X = T.first;
int Y = T.second;
for(int i=-10;i<=10;i++){
for(int j=-10;j<=10;j++){
if(i*i+j*j<100){
int x = X+i,y = Y+j;
if(x<0||y<0||x>500||y>500)continue;
ind[x][y]=-1;
}
}
}
}
cout<<ans.size()<<endl;
for(int i=0;i<ans.size();i++){
if(i!=0)cout<<' ';
cout<<ans[i]+1;
}
cout<<endl;
return 0;
}
沙耶花