Submission #494736

# Submission time Handle Problem Language Result Execution time Memory
494736 2021-12-16T04:37:53 Z Khizri Fountain Parks (IOI21_parks) C++17
5 / 100
51 ms 8364 KB
#include "parks.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
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 bfs(int x,int y){
    queue<pii>q;
    q.push({x,y});
    color[x][y]=1;
    while(q.size()){
        pii p=q.front();
        q.pop();
        x=p.F,y=p.S;
        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(v-1);
                q.push({u,v});
                color[u][v]=1;
            }
        }
    }
}
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;
    }
    bfs(2,pos);
    if(say==n){
        build(a,b,c,d);
        return 1;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 284 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 51 ms 8260 KB Output is correct
10 Correct 5 ms 1356 KB Output is correct
11 Correct 26 ms 4668 KB Output is correct
12 Correct 12 ms 1688 KB Output is correct
13 Correct 9 ms 2316 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 48 ms 8364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 284 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 51 ms 8260 KB Output is correct
10 Correct 5 ms 1356 KB Output is correct
11 Correct 26 ms 4668 KB Output is correct
12 Correct 12 ms 1688 KB Output is correct
13 Correct 9 ms 2316 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 48 ms 8364 KB Output is correct
17 Incorrect 0 ms 332 KB Tree @(3, 3) appears more than once: for edges on positions 0 and 2
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 284 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 51 ms 8260 KB Output is correct
10 Correct 5 ms 1356 KB Output is correct
11 Correct 26 ms 4668 KB Output is correct
12 Correct 12 ms 1688 KB Output is correct
13 Correct 9 ms 2316 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 48 ms 8364 KB Output is correct
17 Incorrect 0 ms 332 KB Tree @(3, 3) appears more than once: for edges on positions 0 and 2
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 284 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 51 ms 8260 KB Output is correct
10 Correct 5 ms 1356 KB Output is correct
11 Correct 26 ms 4668 KB Output is correct
12 Correct 12 ms 1688 KB Output is correct
13 Correct 9 ms 2316 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 48 ms 8364 KB Output is correct
17 Runtime error 1 ms 432 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 284 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 51 ms 8260 KB Output is correct
10 Correct 5 ms 1356 KB Output is correct
11 Correct 26 ms 4668 KB Output is correct
12 Correct 12 ms 1688 KB Output is correct
13 Correct 9 ms 2316 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 48 ms 8364 KB Output is correct
17 Runtime error 39 ms 6908 KB Execution killed with signal 11
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 284 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 51 ms 8260 KB Output is correct
10 Correct 5 ms 1356 KB Output is correct
11 Correct 26 ms 4668 KB Output is correct
12 Correct 12 ms 1688 KB Output is correct
13 Correct 9 ms 2316 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 48 ms 8364 KB Output is correct
17 Incorrect 0 ms 332 KB Tree @(3, 3) appears more than once: for edges on positions 0 and 2
18 Halted 0 ms 0 KB -