제출 #387022

#제출 시각아이디문제언어결과실행 시간메모리
387022Koosha_mv이상적인 도시 (IOI12_city)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define erorp(x) cout<<#x<<"={"<<(x.F)<<" , "<<x.S<<"}"<<endl; #define print(v,r) f(i,0,r) cout<<v[i]<<" "; cout<<endl; #define Get(x,y) scanf("%I64d%I64d",&x,&y); #define is_bit(x,y) (x%(1<<(y+1))>=(1<<y)) #define eror(x) cout<<#x<<'='<<(x)<<endl; #define f_(i,a,b) for(int i=a;i>=b;i--) #define Gett(x,y) scanf("%d%d",&x,&y); #define f(i,a,b) for(int i=a;i<b;i++) #define get(x) scanf("%I64d",&x); #define gett(x) scanf("%d",&x); #define maxm(a,b) a=max(a,b); #define minm(a,b) a=min(a,b); #define Add(x,y) x=(x+y)%mod #define lst(x) x[x.size()-1] #define sz(x) int(x.size()) #define mp make_pair #define ll long long #define pb push_back #define F first #define S second const int N=1e5+9; int n; ll ans; pair<int,int> a[N]; map<pair<int,int>,int> mark,cnt; ll e(int x){ return 1ll*x*(x-1)/2; } void swap(){ f(i,0,n) swap(a[i].F,a[i].S); } void solve(){ mark.clear(); sort(a,a+n); f(i,0,n){ int x=a[i].F,y=a[i].S; mark[mp(x,y)]=mark[mp(x,y-1)]+1; if(a[i+1].F!=x || a[i+1].S!=y+1){ cnt[mp(x,y)]=cnt[mp(x-1,y)]; ans+=e(n); ans-=e(cnt[mp(x,y)])+e(n-cnt[mp(x,y)]-mark[mp(x,y)]); cnt[mp(x,y)]+=mark[mp(x,y)]; } for(int j=i-1;0<=j && a[j].F==a[j+1].F && a[j].S+1==a[j+1].S;j--) cnt[mp(a[j].F,a[j].S)]=cnt[mp(x,y)]; } } int main(){ cin>>n; f(i,0,n) cin>>a[i].F>>a[i].S; solve(); swap(); solve(); cout<<ans-(e(n)); }

컴파일 시 표준 에러 (stderr) 메시지

/tmp/ccvH6sWf.o: In function `main':
city.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccGmRA2y.o:grader.cpp:(.text.startup+0x0): first defined here
/tmp/ccGmRA2y.o: In function `main':
grader.cpp:(.text.startup+0xff): undefined reference to `DistanceSum(int, int*, int*)'
collect2: error: ld returned 1 exit status