답안 #754025

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
754025 2023-06-06T13:30:33 Z tolbi 분수 공원 (IOI21_parks) C++17
5 / 100
189 ms 17592 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].second+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 0 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 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 158 ms 17460 KB Output is correct
10 Correct 8 ms 2052 KB Output is correct
11 Correct 52 ms 9424 KB Output is correct
12 Correct 15 ms 2908 KB Output is correct
13 Correct 24 ms 5756 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 17592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 158 ms 17460 KB Output is correct
10 Correct 8 ms 2052 KB Output is correct
11 Correct 52 ms 9424 KB Output is correct
12 Correct 15 ms 2908 KB Output is correct
13 Correct 24 ms 5756 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 17592 KB Output is correct
17 Incorrect 1 ms 212 KB b[0] = 4 is not an odd integer
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 158 ms 17460 KB Output is correct
10 Correct 8 ms 2052 KB Output is correct
11 Correct 52 ms 9424 KB Output is correct
12 Correct 15 ms 2908 KB Output is correct
13 Correct 24 ms 5756 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 17592 KB Output is correct
17 Incorrect 1 ms 212 KB b[0] = 4 is not an odd integer
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 158 ms 17460 KB Output is correct
10 Correct 8 ms 2052 KB Output is correct
11 Correct 52 ms 9424 KB Output is correct
12 Correct 15 ms 2908 KB Output is correct
13 Correct 24 ms 5756 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 17592 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 0 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 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 158 ms 17460 KB Output is correct
10 Correct 8 ms 2052 KB Output is correct
11 Correct 52 ms 9424 KB Output is correct
12 Correct 15 ms 2908 KB Output is correct
13 Correct 24 ms 5756 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 17592 KB Output is correct
17 Incorrect 176 ms 15916 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 0 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 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 158 ms 17460 KB Output is correct
10 Correct 8 ms 2052 KB Output is correct
11 Correct 52 ms 9424 KB Output is correct
12 Correct 15 ms 2908 KB Output is correct
13 Correct 24 ms 5756 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 17592 KB Output is correct
17 Incorrect 1 ms 212 KB b[0] = 4 is not an odd integer
18 Halted 0 ms 0 KB -