답안 #494730

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
494730 2021-12-16T04:24:31 Z Khizri 분수 공원 (IOI21_parks) C++17
0 / 100
1 ms 296 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){
    //cout<<x<<' '<<y<<endl;
    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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 296 KB Wrong answer detected in grader
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 296 KB Wrong answer detected in grader
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 296 KB Wrong answer detected in grader
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 296 KB Wrong answer detected in grader
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 296 KB Wrong answer detected in grader
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 296 KB Wrong answer detected in grader
4 Halted 0 ms 0 KB -