結果

問題 No.1121 Social Distancing in Cinema
ユーザー auauaauaua
提出日時 2020-07-22 22:50:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,701 bytes
コンパイル時間 2,182 ms
コンパイル使用メモリ 182,080 KB
実行使用メモリ 13,440 KB
最終ジャッジ日時 2023-09-05 03:02:50
合計ジャッジ時間 10,495 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,432 KB
testcase_01 AC 4 ms
7,264 KB
testcase_02 AC 4 ms
7,284 KB
testcase_03 AC 4 ms
7,284 KB
testcase_04 AC 5 ms
7,272 KB
testcase_05 AC 5 ms
7,308 KB
testcase_06 AC 4 ms
7,248 KB
testcase_07 AC 5 ms
7,312 KB
testcase_08 AC 4 ms
7,284 KB
testcase_09 AC 4 ms
7,364 KB
testcase_10 AC 5 ms
7,320 KB
testcase_11 AC 5 ms
7,472 KB
testcase_12 AC 5 ms
7,336 KB
testcase_13 AC 5 ms
7,376 KB
testcase_14 AC 6 ms
7,440 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 9 ms
7,260 KB
testcase_21 AC 7 ms
7,264 KB
testcase_22 AC 8 ms
7,268 KB
testcase_23 AC 6 ms
7,500 KB
testcase_24 AC 5 ms
7,340 KB
testcase_25 WA -
testcase_26 AC 59 ms
9,056 KB
testcase_27 AC 13 ms
7,368 KB
testcase_28 AC 124 ms
12,592 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 48 ms
9,720 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 36 ms
8,352 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 33 ms
8,104 KB
testcase_41 AC 13 ms
7,388 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 5 ms
7,268 KB
testcase_48 AC 5 ms
7,256 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));
    vector<pair<ll,pll> >b(0);
    rep(i,n){
        ll x,y;cin>>x>>y;
        x--;y--;
        a[x][y]=i+1;
        b.pb(mp(x+y,mp(x,y)));
    }
    sort(all(b));
    vector<vector<ll> >used(500,vector<ll>(500));
    vector<ll>ans(0);
    ll s=(n-1)/90+1;
    rep(now,n){
        ll i=b[now].second.first;
        ll j=b[now].second.second;
            if(used[i][j])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