結果

問題 No.1121 Social Distancing in Cinema
ユーザー auauaauaua
提出日時 2020-07-22 22:36:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,688 bytes
コンパイル時間 1,724 ms
コンパイル使用メモリ 176,100 KB
実行使用メモリ 7,708 KB
最終ジャッジ日時 2023-09-05 02:31:54
合計ジャッジ時間 11,734 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
7,508 KB
testcase_01 AC 4 ms
7,384 KB
testcase_02 AC 5 ms
7,440 KB
testcase_03 AC 4 ms
7,384 KB
testcase_04 AC 4 ms
7,440 KB
testcase_05 AC 5 ms
7,372 KB
testcase_06 AC 5 ms
7,328 KB
testcase_07 AC 5 ms
7,428 KB
testcase_08 AC 4 ms
7,360 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 4 ms
7,512 KB
testcase_48 AC 5 ms
7,620 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,1,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;
                }
            }
            if(ans.size()==s)break;
        }
        if(ans.size()==s)break;
    }
    cout<<s<<endl;
    rep(i,s){
        cout<<ans[i]<<' ';
    }
    cout<<endl;
}
0