結果
問題 | No.1121 Social Distancing in Cinema |
ユーザー |
![]() |
提出日時 | 2020-07-22 22:01:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,398 bytes |
コンパイル時間 | 2,586 ms |
コンパイル使用メモリ | 209,572 KB |
最終ジャッジ日時 | 2025-01-12 02:44:40 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 33 WA * 14 |
コンパイルメッセージ
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)); vector<pair<int,pair<int,int>>> P(N,pair<int,pair<int,int>>(0,pair<int,int>(0,0))); for(int i=0;i<N;i++){ int X,Y; scanf("%d %d",&X,&Y); ind[X][Y] = i; P[i].second.first=X; P[i].second.second=Y; } for(int i=0;i<N;i++){ for(int j=-10;j<=10;j++){ for(int k=-10;k<=10;k++){ if(k*k+j*j<100){ int x = P[i].second.first+j,y = P[i].second.second+k; if(x<0||y<0||x>500||y>500)continue; int t = ind[x][y]; if(t!=-1)P[t].first++; } } } } sort(P.rbegin(),P.rend()); vector<int> ans; while(P.size()!=0){ if((N+89)/90 <= ans.size())break; pair<int,int> T; T = P.back().second; P.pop_back(); 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; }