답안 #332321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
332321 2020-12-02T03:28:26 Z YJU Bubble Sort 2 (JOI18_bubblesort2) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=1e5+5;
const ll K=350;
const ld pi=acos(-1);
const ll INF=(1LL<<30);
#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 setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()



vector<ll> countScans(vector<ll> A,vector<ll> X,vector<ll> V){
	vector<ll> ans;
	ll ma;
	set<ll> cnt[105];
	REP(i,SZ(V))ma=max(ma,V[i]);
	REP(i,SZ(A))ma=max(ma,A[i]);
	if(ma<=100)REP(i,SZ(A))cnt[A[i]].insert(i);
	REP(i,SZ(X)){
		if(ma<=100){
			cnt[A[X[i]]].erase(X[i]);cnt[A[X[i]]=V[i]].insert(X[i]);
			ll res=0,pre=0;
			REP1(j,ma){
				if(SZ(cnt[j])==0)continue;
				res=max(res,*prev(cnt[j].end())-pre-(SZ(cnt[j])-1));
				pre+=SZ(cnt[j]);
			}
			ans.pb(res);
		}else{
			A[X[i]]=V[i];
			vector<pll> a;
			ll res=0;
			REP(j,SZ(A))a.pb(mp(A[j],j));
			sort(a.begin(),a.end());
			REP(j,SZ(a))res=max(res,a[j].second-j);
			ans.pb(res);
		}
	}
	return ans;
}

///*
int main(){
	vector<ll> A,X,V;
	ll n,q,x;
	cin>>n>>q;
	REP(i,n)cin>>x,A.pb(x);
	REP(i,q)cin>>x,X.pb(x),cin>>x,V.pb(x);
	vector<ll> ans=countScans(A,X,V);
	for(ll i:ans)cout<<i<<"\n";
}
//*/

Compilation message

/tmp/ccy3OCdv.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc1eIT82.o:bubblesort2.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status