답안 #754000

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
754000 2023-06-06T13:14:21 Z tolbi 분수 공원 (IOI21_parks) C++17
0 / 100
1 ms 212 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+1){
    		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:23: 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:23: 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 Incorrect 1 ms 212 KB Solution announced impossible, but it is possible.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Solution announced impossible, but it is possible.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Solution announced impossible, but it is possible.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Solution announced impossible, but it is possible.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Solution announced impossible, but it is possible.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Solution announced impossible, but it is possible.
3 Halted 0 ms 0 KB -