제출 #1344317

#제출 시각아이디문제언어결과실행 시간메모리
1344317kokorooA String Problem (EGOI25_stringproblem)C++20
0 / 100
0 ms344 KiB
#include<bits/stdc++.h>
//#include<atcoder/all>

using namespace std;
//using namespace atcoder;
#define rep(i,n) for(ll i=0; i<n; i++)
#define rrep(i,n) for(ll i=n-1; i>=0; i--)
#define print(a) cout<<a<<endl
typedef long long ll;
#define yn(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YN(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define so(a) sort(a.begin(),a.end())
#define mp make_pair
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define pb push_back
#define a2i(a,s) (ll)(a-s)
#define i2a(s,a) (char)(s+a)
#define ssize(a) a.size()
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<pair<ll,ll>,ll> P3;
typedef pair<pair<ll,ll>,pair<ll,ll>> P4;

typedef pair<ll, ll> Pll;
typedef pair<ll,Pll> Plll;
typedef pair<Pii, int> Piii;
const ll INF = 1000000000000000000;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;

}
using ull=unsigned long long;

int main(){
//入力

	cin.tie(0);
	ios::sync_with_stdio(0);


	ll n;
	cin>>n;

	vector<Pll> g(n);
	map<Pll,ll> mp;
	map<ll,ll> mp2;

	for(ll i=0;i<n;i++){
		ll a,b;
		cin>>a>>b;
		if(a>b)swap(a,b);
		g[i]={a,b};

		ll p=(b-a)/2;
		if((b-a)%2==1){
			mp[{a+p,a+p+1}]++;
			mp[{(b+p)%(2*n),(b+p+1)%(2*n)}]++;

		}
		mp2[a]=i;
		mp2[b]=i;

	}

	ll ans=-INF;
	Pll p={0,0};
	for(ll i=0;i<2*n-1;i++){
		if(ans<mp[{i,i+1}]){
			ans=mp[{i,i+1}];
			p={i,i+1};
		}
	}
	if(ans<mp[{0,2*n-1}]){
		ans=mp[{0,2*n-1}];
		p={0,2*n-1};

	}

	cout<<n-ans<<endl;

	vector<ll> v(n);
	vector<ll> V(2*n);

//	for(ll i=0;i<n;i++){
//		if(v[i]==0){
//			v[i]=1;
//			ll X=p.first-g[i].first+p.second;
//			X=X%(2*n);
//
//			V[g[i].first]=1;
//			cout<<i<<" "<<g[i].second<<" "<<X<<endl;
//			V[X]=1;
//
//			while(true){
//
//			}
//
//		}
//	}
//

	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...