Submission #494729

# Submission time Handle Problem Language Result Execution time Memory
494729 2021-12-16T04:21:30 Z Khizri Fountain Parks (IOI21_parks) C++17
0 / 100
62 ms 81832 KB
#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
const int mxn=2e5+5;
int n,color[5][mxn],arr[5][mxn],say;
int l[4]={0,0,2,-2};
int r[4]={2,-2,0,0};
vector<int>a,b,c,d;
void dfs(int x,int y){
    color[x][y]=1;
    say++;
    for(int i=0;i<4;i++){
        int u=x+l[i],v=y+r[i];
        if(arr[u][v]&&!color[u][v]){
            a.pb(arr[x][y]-1);
            b.pb(arr[u][v]-1);
            c.pb(x-1);
            d.pb(max(v,y)-1);
        }
        dfs(u,v);
    }
}
int construct_roads(vector<int> x, vector<int> y) {
    n=x.size();
    int pos=1e7;
    for(int i=0;i<n;i++){
        pos=min(pos,y[i]);
        arr[x[i]][y[i]]=i+1;
    }
    dfs(2,pos);
    if(say==n){
        build(a,b,c,d);
        return 1;
    }
    return 1;
}
# Verdict Execution time Memory Grader output
1 Runtime error 62 ms 81832 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 62 ms 81832 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 62 ms 81832 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 62 ms 81832 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 62 ms 81832 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 62 ms 81832 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -