답안 #740191

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
740191 2023-05-12T06:57:39 Z vjudge1 분수 공원 (IOI21_parks) C++17
5 / 100
426 ms 141404 KB
#include "parks.h"
#include <bits/stdc++.h>
#define f first
#define s second 
#define ent '\n'
//#define int long long

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")

//typedef long double ld;
typedef long long ll;
using namespace std;
 
struct node{double x,y;};
//double len(node a,node b)
//{return sqrt((a.x-b.x)*(a.x-b.y)+(a.y-b.y)*(a.x-b.y));}

struct seg{
	int l,r,id;
};

const string out[2]={"NO\n","YES\n"};
const ll dx[]={-1,-1,1,1};  
const ll dy[]={-1,1,-1,1};
const ll dxx[]={0,0,2,-2};
const ll dyy[]={2,-2,0,0};
const int md=998244353;
const int mod=1e9+7;
const int mx=8e5+12; 
const int tst=1e5;
const bool T=0;

pair<int,pair<int,int>> p[mx];
map<int,bool> used[mx];
map<int,int> pos[mx];
vector<int> g[mx];
int ma[mx];
int mi[mx];

void dfs(int x,int y){
	used[x][y]=1;
	ma[x]=max(ma[x],y);
	mi[x]=min(mi[x],y);
	for(int k=0;k<4;k++){
		int x1=x+dxx[k];
		int y1=y+dyy[k];
		if(!used[x1].count(y1) && pos[x1].count(y1))dfs(x1,y1);
	}
}

int construct_roads(std::vector<int> x, std::vector<int> y) {
	int n=x.size();
	for(int i=1;i<=n;i++){
		p[i]={x[i-1],{y[i-1],i}};
	}
	sort(p+1,p+n+1);
	int mx=0;
	reverse(x.begin(),x.end());
	reverse(y.begin(),y.end());
	x.push_back(0);
	y.push_back(0);
	reverse(x.begin(),x.end());
	reverse(y.begin(),y.end());
	for(int i=1;i<=n;i++){
		mx=max(mx,x[i]);
		pos[x[i]][y[i]]=i-1;
	}
	for(int i=0;i<=mx;i++)mi[i]=1e9;
	dfs(x[1],y[1]);
	for(int i=1;i<=n;i++){
		if(!used[x[i]][y[i]]){
			return 0;
		}
	}
	vector<int> u,v,a,b;
	for(int i=mi[2];i<ma[2];i+=2){
		u.push_back(pos[2][i]);
		v.push_back(pos[2][i+2]);
		a.push_back(1);
		b.push_back(i+1);
	}
	if(mx==2){
		build(u,v,a,b);
		return 1;
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 94136 KB Output is correct
2 Correct 61 ms 94184 KB Output is correct
3 Correct 59 ms 94196 KB Output is correct
4 Correct 59 ms 94140 KB Output is correct
5 Correct 53 ms 94124 KB Output is correct
6 Correct 56 ms 94232 KB Output is correct
7 Correct 60 ms 94160 KB Output is correct
8 Correct 60 ms 94196 KB Output is correct
9 Correct 272 ms 120884 KB Output is correct
10 Correct 72 ms 97164 KB Output is correct
11 Correct 142 ms 108880 KB Output is correct
12 Correct 74 ms 98508 KB Output is correct
13 Correct 95 ms 102160 KB Output is correct
14 Correct 61 ms 94364 KB Output is correct
15 Correct 51 ms 94372 KB Output is correct
16 Correct 284 ms 117016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 94136 KB Output is correct
2 Correct 61 ms 94184 KB Output is correct
3 Correct 59 ms 94196 KB Output is correct
4 Correct 59 ms 94140 KB Output is correct
5 Correct 53 ms 94124 KB Output is correct
6 Correct 56 ms 94232 KB Output is correct
7 Correct 60 ms 94160 KB Output is correct
8 Correct 60 ms 94196 KB Output is correct
9 Correct 272 ms 120884 KB Output is correct
10 Correct 72 ms 97164 KB Output is correct
11 Correct 142 ms 108880 KB Output is correct
12 Correct 74 ms 98508 KB Output is correct
13 Correct 95 ms 102160 KB Output is correct
14 Correct 61 ms 94364 KB Output is correct
15 Correct 51 ms 94372 KB Output is correct
16 Correct 284 ms 117016 KB Output is correct
17 Incorrect 53 ms 94228 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 94136 KB Output is correct
2 Correct 61 ms 94184 KB Output is correct
3 Correct 59 ms 94196 KB Output is correct
4 Correct 59 ms 94140 KB Output is correct
5 Correct 53 ms 94124 KB Output is correct
6 Correct 56 ms 94232 KB Output is correct
7 Correct 60 ms 94160 KB Output is correct
8 Correct 60 ms 94196 KB Output is correct
9 Correct 272 ms 120884 KB Output is correct
10 Correct 72 ms 97164 KB Output is correct
11 Correct 142 ms 108880 KB Output is correct
12 Correct 74 ms 98508 KB Output is correct
13 Correct 95 ms 102160 KB Output is correct
14 Correct 61 ms 94364 KB Output is correct
15 Correct 51 ms 94372 KB Output is correct
16 Correct 284 ms 117016 KB Output is correct
17 Incorrect 53 ms 94228 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 94136 KB Output is correct
2 Correct 61 ms 94184 KB Output is correct
3 Correct 59 ms 94196 KB Output is correct
4 Correct 59 ms 94140 KB Output is correct
5 Correct 53 ms 94124 KB Output is correct
6 Correct 56 ms 94232 KB Output is correct
7 Correct 60 ms 94160 KB Output is correct
8 Correct 60 ms 94196 KB Output is correct
9 Correct 272 ms 120884 KB Output is correct
10 Correct 72 ms 97164 KB Output is correct
11 Correct 142 ms 108880 KB Output is correct
12 Correct 74 ms 98508 KB Output is correct
13 Correct 95 ms 102160 KB Output is correct
14 Correct 61 ms 94364 KB Output is correct
15 Correct 51 ms 94372 KB Output is correct
16 Correct 284 ms 117016 KB Output is correct
17 Incorrect 57 ms 94916 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 94136 KB Output is correct
2 Correct 61 ms 94184 KB Output is correct
3 Correct 59 ms 94196 KB Output is correct
4 Correct 59 ms 94140 KB Output is correct
5 Correct 53 ms 94124 KB Output is correct
6 Correct 56 ms 94232 KB Output is correct
7 Correct 60 ms 94160 KB Output is correct
8 Correct 60 ms 94196 KB Output is correct
9 Correct 272 ms 120884 KB Output is correct
10 Correct 72 ms 97164 KB Output is correct
11 Correct 142 ms 108880 KB Output is correct
12 Correct 74 ms 98508 KB Output is correct
13 Correct 95 ms 102160 KB Output is correct
14 Correct 61 ms 94364 KB Output is correct
15 Correct 51 ms 94372 KB Output is correct
16 Correct 284 ms 117016 KB Output is correct
17 Incorrect 426 ms 141404 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 94136 KB Output is correct
2 Correct 61 ms 94184 KB Output is correct
3 Correct 59 ms 94196 KB Output is correct
4 Correct 59 ms 94140 KB Output is correct
5 Correct 53 ms 94124 KB Output is correct
6 Correct 56 ms 94232 KB Output is correct
7 Correct 60 ms 94160 KB Output is correct
8 Correct 60 ms 94196 KB Output is correct
9 Correct 272 ms 120884 KB Output is correct
10 Correct 72 ms 97164 KB Output is correct
11 Correct 142 ms 108880 KB Output is correct
12 Correct 74 ms 98508 KB Output is correct
13 Correct 95 ms 102160 KB Output is correct
14 Correct 61 ms 94364 KB Output is correct
15 Correct 51 ms 94372 KB Output is correct
16 Correct 284 ms 117016 KB Output is correct
17 Incorrect 53 ms 94228 KB Solution announced impossible, but it is possible.
18 Halted 0 ms 0 KB -