답안 #754028

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
754028 2023-06-06T13:31:30 Z tolbi 분수 공원 (IOI21_parks) C++17
15 / 100
418 ms 30028 KB
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
#define author tolbi
#include <bits/stdc++.h>
using namespace std;
template<typename X, typename Y> istream& operator>>(istream& in, pair<X,Y> &pr) {return in>>pr.first>>pr.second;}
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr) {return os<<pr.first<<" "<<pr.second;}
template<typename X> istream& operator>>(istream& in, vector<X> &arr) {for(auto &it : arr) in>>it; return in;}
template<typename X> ostream& operator<<(ostream& os, vector<X> arr) {for(auto &it : arr) os<<it<<" "; return os;}
template<typename X, size_t Y> istream& operator>>(istream& in, array<X,Y> &arr) {for(auto &it : arr) in>>it; return in;}
template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> arr) {for(auto &it : arr) os<<it<<" "; return os;}
template<typename T> vector<int32_t> normalize(vector<T> &arr){vector<int32_t> rv;rv.resize(arr.size());for (int i = 0; i < rv.size(); ++i){rv[i]=arr[i];}return rv;}
#define endl '\n'
#define vint(x) vector<int> x
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(),x.end())
#define sortrarr(x) sort(x.rbegin(),x.rend())
#define det(x) cout<<"NO\0YES"+x*3<<endl;
#define INF LONG_LONG_MAX
#define rev(x) reverse(x.begin(),x.end());
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define tol(bi) (1LL<<((int)(bi)))
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#include "parks.h"
int32_t construct_roads(vector<int32_t> x, vector<int32_t> y) {
	int n = x.size();
	if (x.size() == 1) {
		build({}, {}, {}, {});
		return 1;
	}
	map<int,int> mpa;
	map<int,int> mpb;
	map<int,int> mp;
	for (int i = 0; i < n; ++i)
	{
		if (x[i]==2){
			mp[y[i]]|=1;
			mpa[y[i]]=i;
		}
		else {
			mp[y[i]]|=2;
			mpb[y[i]]=i;
		}
	}
	vector<pair<int,int>> arr;
	for (auto it : mp){
		arr.push_back(it);
	}
	for (int i = 1; i < arr.size(); i++){
		if (arr[i].first!=arr[i-1].first+2){
			return 0;
		}
		if (!(arr[i].second&arr[i-1].second)) return 0;
	}
	vector<int32_t> u, v, a, b;
	for (int i = 0; i < arr.size(); i++){
		if (arr[i].second==3){
			u.push_back(mpa[arr[i].first]);
			v.push_back(mpb[arr[i].first]);
			a.push_back(3);
			b.push_back(arr[i].first+1);
		}
		if (i){
			int vv = arr[i].second&arr[i-1].second;
			if (vv&1){
				u.push_back(mpa[arr[i].first]);
				v.push_back(mpa[arr[i-1].first]);
				a.push_back(1);
				b.push_back(arr[i-1].first+1);
			}
			else {
				u.push_back(mpb[arr[i].first]);
				v.push_back(mpb[arr[i-1].first]);
				a.push_back(5);
				b.push_back(arr[i-1].first+1);
			}
		}
	}
	build(u, v, a, b);
	return 1;
}

Compilation message

parks.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      | 
parks.cpp: In function 'int32_t construct_roads(std::vector<int>, std::vector<int>)':
parks.cpp:61:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |  for (int i = 1; i < arr.size(); i++){
      |                  ~~^~~~~~~~~~~~
parks.cpp:68:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |  for (int i = 0; i < arr.size(); i++){
      |                  ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 148 ms 17692 KB Output is correct
10 Correct 10 ms 2204 KB Output is correct
11 Correct 60 ms 9548 KB Output is correct
12 Correct 16 ms 3008 KB Output is correct
13 Correct 32 ms 5832 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 189 ms 17824 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 148 ms 17692 KB Output is correct
10 Correct 10 ms 2204 KB Output is correct
11 Correct 60 ms 9548 KB Output is correct
12 Correct 16 ms 3008 KB Output is correct
13 Correct 32 ms 5832 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 189 ms 17824 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 397 ms 30028 KB Output is correct
24 Correct 1 ms 300 KB Output is correct
25 Correct 2 ms 468 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 3 ms 596 KB Output is correct
28 Correct 118 ms 12384 KB Output is correct
29 Correct 202 ms 18008 KB Output is correct
30 Correct 288 ms 24516 KB Output is correct
31 Correct 418 ms 29992 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 2 ms 468 KB Output is correct
44 Correct 2 ms 596 KB Output is correct
45 Correct 145 ms 16960 KB Output is correct
46 Correct 261 ms 23816 KB Output is correct
47 Correct 291 ms 23972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 148 ms 17692 KB Output is correct
10 Correct 10 ms 2204 KB Output is correct
11 Correct 60 ms 9548 KB Output is correct
12 Correct 16 ms 3008 KB Output is correct
13 Correct 32 ms 5832 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 189 ms 17824 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 397 ms 30028 KB Output is correct
24 Correct 1 ms 300 KB Output is correct
25 Correct 2 ms 468 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 3 ms 596 KB Output is correct
28 Correct 118 ms 12384 KB Output is correct
29 Correct 202 ms 18008 KB Output is correct
30 Correct 288 ms 24516 KB Output is correct
31 Correct 418 ms 29992 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 2 ms 468 KB Output is correct
44 Correct 2 ms 596 KB Output is correct
45 Correct 145 ms 16960 KB Output is correct
46 Correct 261 ms 23816 KB Output is correct
47 Correct 291 ms 23972 KB Output is correct
48 Incorrect 1 ms 212 KB Given structure is not connected: There is no path between vertices 0 and 1
49 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 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 148 ms 17692 KB Output is correct
10 Correct 10 ms 2204 KB Output is correct
11 Correct 60 ms 9548 KB Output is correct
12 Correct 16 ms 3008 KB Output is correct
13 Correct 32 ms 5832 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 189 ms 17824 KB Output is correct
17 Incorrect 1 ms 212 KB Pair u[0]=1 @(200000, 4) and v[0]=2 @(199998, 2) does not form a valid edge (distance != 2)
18 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 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 148 ms 17692 KB Output is correct
10 Correct 10 ms 2204 KB Output is correct
11 Correct 60 ms 9548 KB Output is correct
12 Correct 16 ms 3008 KB Output is correct
13 Correct 32 ms 5832 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 189 ms 17824 KB Output is correct
17 Incorrect 162 ms 16076 KB Pair u[0]=199575 @(2, 2) and v[0]=199999 @(62538, 2) does not form a valid edge (distance != 2)
18 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 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 148 ms 17692 KB Output is correct
10 Correct 10 ms 2204 KB Output is correct
11 Correct 60 ms 9548 KB Output is correct
12 Correct 16 ms 3008 KB Output is correct
13 Correct 32 ms 5832 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 189 ms 17824 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 397 ms 30028 KB Output is correct
24 Correct 1 ms 300 KB Output is correct
25 Correct 2 ms 468 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 3 ms 596 KB Output is correct
28 Correct 118 ms 12384 KB Output is correct
29 Correct 202 ms 18008 KB Output is correct
30 Correct 288 ms 24516 KB Output is correct
31 Correct 418 ms 29992 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 2 ms 468 KB Output is correct
44 Correct 2 ms 596 KB Output is correct
45 Correct 145 ms 16960 KB Output is correct
46 Correct 261 ms 23816 KB Output is correct
47 Correct 291 ms 23972 KB Output is correct
48 Incorrect 1 ms 212 KB Given structure is not connected: There is no path between vertices 0 and 1
49 Halted 0 ms 0 KB -