답안 #338477

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
338477 2020-12-23T09:07:08 Z YJU Rope (JOI17_rope) C++14
0 / 100
3 ms 5100 KB
#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=2e5+5;
const ld pi=acos(-1);
const ll INF=(1LL<<60);
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()
ll u[N],n,m,cnt[N],ans[N],mx[2];
vector<pair<ll,pll> > v[N];
 
/*ll seg[2*N][2];
 
void ins(ll sid,ll id,ll l,ll r,ll to,ll d){
	for(to+=m,seg[to][sid]+=d;to>1;to>>=1){
		seg[to>>1][sid]=max(seg[to][sid],seg[to^1][sid]);
	}
}
 
void add(ll sid,pll A){
	if(A.X==A.Y){
		if(A.X)v[A.X].pb(mp(sid,A));
	}else{
		if(A.X)v[A.X].pb(mp(sid,A));
		if(A.Y)v[A.Y].pb(mp(sid,A));
	}
	if(A.X)ins(sid,1,1,m+1,A.X,1);
	if(A.Y)ins(sid,1,1,m+1,A.Y,1);
}
*/ 
 
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n>>m;
	REP1(i,n){
		cin>>u[i];
		++cnt[u[i]];
	}
	REP1(i,m){
		ll tx=i;
		REP(j,2)if(cnt[mx[j]]<=cnt[tx])swap(tx,mx[j]);
	} 
	REP1(i,m){
		cout<<n-cnt[i]-(i==mx[0]?cnt[mx[1]]:cnt[mx[0]])<<"\n";
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5100 KB Output is correct
2 Correct 3 ms 5100 KB Output is correct
3 Incorrect 3 ms 5100 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5100 KB Output is correct
2 Correct 3 ms 5100 KB Output is correct
3 Incorrect 3 ms 5100 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5100 KB Output is correct
2 Correct 3 ms 5100 KB Output is correct
3 Incorrect 3 ms 5100 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5100 KB Output is correct
2 Correct 3 ms 5100 KB Output is correct
3 Incorrect 3 ms 5100 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5100 KB Output is correct
2 Correct 3 ms 5100 KB Output is correct
3 Incorrect 3 ms 5100 KB Output isn't correct
4 Halted 0 ms 0 KB -