結果

問題 No.1121 Social Distancing in Cinema
ユーザー auauaauaua
提出日時 2020-07-22 22:23:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,618 bytes
コンパイル時間 1,783 ms
コンパイル使用メモリ 174,444 KB
実行使用メモリ 7,600 KB
最終ジャッジ日時 2023-09-04 21:28:42
合計ジャッジ時間 7,234 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
7,356 KB
testcase_01 AC 6 ms
7,428 KB
testcase_02 AC 5 ms
7,268 KB
testcase_03 AC 5 ms
7,308 KB
testcase_04 AC 5 ms
7,268 KB
testcase_05 AC 5 ms
7,372 KB
testcase_06 AC 5 ms
7,280 KB
testcase_07 AC 5 ms
7,264 KB
testcase_08 AC 5 ms
7,364 KB
testcase_09 AC 5 ms
7,348 KB
testcase_10 AC 5 ms
7,268 KB
testcase_11 AC 5 ms
7,268 KB
testcase_12 AC 5 ms
7,424 KB
testcase_13 AC 6 ms
7,348 KB
testcase_14 AC 6 ms
7,584 KB
testcase_15 AC 8 ms
7,288 KB
testcase_16 AC 16 ms
7,600 KB
testcase_17 AC 49 ms
7,368 KB
testcase_18 AC 88 ms
7,424 KB
testcase_19 AC 103 ms
7,512 KB
testcase_20 AC 8 ms
7,268 KB
testcase_21 AC 7 ms
7,420 KB
testcase_22 AC 7 ms
7,284 KB
testcase_23 AC 7 ms
7,324 KB
testcase_24 AC 6 ms
7,460 KB
testcase_25 AC 37 ms
7,368 KB
testcase_26 AC 44 ms
7,316 KB
testcase_27 AC 12 ms
7,328 KB
testcase_28 AC 93 ms
7,400 KB
testcase_29 AC 41 ms
7,404 KB
testcase_30 AC 29 ms
7,332 KB
testcase_31 AC 103 ms
7,316 KB
testcase_32 AC 79 ms
7,416 KB
testcase_33 AC 37 ms
7,408 KB
testcase_34 AC 38 ms
7,428 KB
testcase_35 AC 84 ms
7,364 KB
testcase_36 AC 100 ms
7,364 KB
testcase_37 AC 29 ms
7,428 KB
testcase_38 AC 43 ms
7,376 KB
testcase_39 AC 92 ms
7,400 KB
testcase_40 AC 25 ms
7,272 KB
testcase_41 AC 11 ms
7,308 KB
testcase_42 AC 99 ms
7,364 KB
testcase_43 AC 99 ms
7,320 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 6 ms
7,328 KB
testcase_48 AC 6 ms
7,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=998244353;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
signed main(){
    ll n;cin>>n;
    vector<vector<ll> >a(500,vector<ll>(500));
    rep(i,n){
        ll x,y;cin>>x>>y;
        x--;y--;
        a[x][y]=i+1;
    }
    vector<vector<ll> >used(500,vector<ll>(500));
    vector<ll>ans(0);
    ll s=(n-1)/90+1;
    rep(i,500){
        rep(j,500){
            if(used[i][j])continue;
            if(a[i][j]==0)continue;
            ans.pb(a[i][j]);
            used[i][j]=1;
            queue<pll>q;
            q.push(mp(i,j));
            while(!q.empty()){
                pll k=q.front();
                q.pop();
                ll x=k.first;
                ll y=k.second;
                rep(l,4){
                    ll nx=x+dx[l];
                    ll ny=y+dy[l];
                    if(nx<0||nx>=500||ny<0||ny>=500)continue;
                    if((nx-i)*(nx-i)+(ny-j)*(ny-j)>=100)continue;
                    if(used[nx][ny])continue;
                    q.push(mp(nx,ny));
                    used[nx][ny]=1;
                }
            }
        }
    }
    cout<<s<<endl;
    rep(i,s){
        cout<<ans[i]<<' ';
    }
    cout<<endl;
}
0