답안 #819859

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
819859 2023-08-10T14:28:46 Z Marco_Escandon 분수 공원 (IOI21_parks) C++17
0 / 100
1 ms 340 KB
#include "parks.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll cad[7][200004]={ };
int construct_roads(std::vector<int> x, std::vector<int> y) {
    if (x.size() == 1) {
	build({}, {}, {}, {});
        return 1;
    }
    ll n=x.size();
    for(int i=0; i<n; i++)
    {
        cad[x[i]][y[i]]=i+1;
    }
    n=200001;
    std::vector<int> u, v, a, b;
    ll pl=0;
    ll pl2=0;
    for(int i=2; i<n; i+=2)
    {
        if(cad[2][i]==0&&cad[4][i]==0&&cad[6][i]==0)
        {
            if(pl==1)
            {
                if(pl==1)

                pl2=1;
            }
        }
        else pl=1;
        if(cad[2][i]!=0&&cad[2][i+2]!=0)
        {
            u.push_back(cad[2][i]-1);
            v.push_back(cad[2][i+2]-1);
            a.push_back(1);
            b.push_back(i+1);
        }
        if(cad[6][i]!=0&&cad[6][i+2]!=0)
        {
            u.push_back(cad[6][i]-1);
            v.push_back(cad[6][i+2]-1);
            a.push_back(7);
            b.push_back(i+1);
        }
    }
    for(int i=2; i<n; i+=2)
    {
        if(cad[4][i]!=0&&cad[4][i+2]==0)
        {
            if(cad[2][i]!=0)
            {
                u.push_back(cad[2][i]-1);
                v.push_back(cad[4][i]-1);
                a.push_back(3);
                b.push_back(i+1);
            }
            if(cad[6][i]!=0)
            {
                u.push_back(cad[4][i]-1);
                v.push_back(cad[6][i]-1);
                a.push_back(5);
                b.push_back(i+1);
            }
        }
        else if(cad[4][i]!=0&&cad[2][i+2]==0&&cad[2][i]!=0&&cad[6][i+2]==0&&cad[6][i]!=0)
        {
            u.push_back(cad[4][i]-1);
            v.push_back(cad[4][i+2]-1);
            a.push_back(3);
            b.push_back(i+1);

            u.push_back(cad[2][i]-1);
            v.push_back(cad[4][i]-1);
            a.push_back(3);
            b.push_back(i-1);


            u.push_back(cad[6][i]-1);
            v.push_back(cad[4][i]-1);
            a.push_back(5);
            b.push_back(i+1);
        }
        else if(cad[4][i]!=0&&cad[2][i+2]==0&&cad[2][i]!=0)
        {
            u.push_back(cad[4][i]-1);
            v.push_back(cad[4][i+2]-1);
            a.push_back(5);
            b.push_back(i+1);
            u.push_back(cad[2][i]);
            v.push_back(cad[4][i]);
            a.push_back(3);
            b.push_back(i+1);
        }
        else if(cad[4][i]!=0&&cad[6][i+2]==0&&cad[6][i]!=0)
        {
            u.push_back(cad[4][i]-1);
            v.push_back(cad[4][i+2]-1);
            a.push_back(3);
            b.push_back(i+1);
            u.push_back(cad[6][i]-1);
            v.push_back(cad[4][i]-1);
            a.push_back(5);
            b.push_back(i+1);
        }
        else if(cad[4][i]!=0&&cad[4][i+2]!=0)
        {
            u.push_back(cad[4][i]-1);
            v.push_back(cad[4][i+2]-1);
            a.push_back(5);
            b.push_back(i+1);
        }
    }
    /*for(int i=0; i<a.size(); i++)
    {
        cout<<u[i]<<" "<<v[i]<<" "<<a[i]<<" "<<b[i]<<"\n";
    }*/
    build(u, v, a, b);
    return 1;
}

Compilation message

parks.cpp: In function 'int construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:19:8: warning: variable 'pl2' set but not used [-Wunused-but-set-variable]
   19 |     ll pl2=0;
      |        ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 340 KB Given structure is not connected: There is no path between vertices 0 and 1
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 340 KB Given structure is not connected: There is no path between vertices 0 and 1
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 340 KB Given structure is not connected: There is no path between vertices 0 and 1
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 340 KB Given structure is not connected: There is no path between vertices 0 and 1
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 340 KB Given structure is not connected: There is no path between vertices 0 and 1
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 340 KB Given structure is not connected: There is no path between vertices 0 and 1
4 Halted 0 ms 0 KB -