답안 #202006

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
202006 2020-02-13T03:18:02 Z Segtree Bubble Sort 2 (JOI18_bubblesort2) C++14
컴파일 오류
0 ms 0 KB
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include"bubblesort2.h"
#pragma gcc optimize("O3")
#pragma gcc optimize("unroll-loops")
#pragma gcc target("avx2,see4")
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
ll solve(vll a){
    ll n=a.size(),ans=0;
    while(1){
	bool done=0;
	for(int i=0;i<=n-2;i++){
	    if(a[i]>a[i+1]){
		swap(a[i],a[i+1]);
		done=1;
	    }
	}
	if(!done)break;
	ans++;
    }
    return ans;
}
vll countScans(vll a,vll x,vll v){
    ll n=a.size(),q=x.size();
    if(n>2000)return a;
    vll fans;
    rep(k,q){
	a[x[k]]=v[k];
	fans.push_back(solve(a));
    }
    return fans;
}
/*int main(){
    ll n,q;
    cin>>n>>q;
    vll a(n),x(q),v(q);
    rep(i,n)cin>>a[i];
    rep(i,q)cin>>x[i]>>v[i];
    vll res=countScans(a,x,v);
    for(auto t:res)cout<<t<<endl;
}
*/

Compilation message

bubblesort2.cpp:9:0: warning: ignoring #pragma gcc optimize [-Wunknown-pragmas]
 #pragma gcc optimize("O3")
 
bubblesort2.cpp:10:0: warning: ignoring #pragma gcc optimize [-Wunknown-pragmas]
 #pragma gcc optimize("unroll-loops")
 
bubblesort2.cpp:11:0: warning: ignoring #pragma gcc target [-Wunknown-pragmas]
 #pragma gcc target("avx2,see4")
 
/tmp/ccwjxpsg.o: In function `main':
grader.cpp:(.text.startup+0x12b): undefined reference to `countScans(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status