답안 #667823

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
667823 2022-12-02T06:13:20 Z coding_snorlax Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "shoes.h"
using namespace std;
int N=200050;
//multiset<pair<int,int>> place;
long long int check_List[400050];
long long int BIT[400050]={0};
deque<int> positive[200060];
deque<int> negative[200060];
//vector<int> List={1,2,3,-3,2,1,1,1,-2,1,1,-1,-1,-2,-1,-1,-1,-1};
int List1[200006]={0};
void pre(vector<int> List){
    for(int i=0;i<(int)List.size();i++){
        if(List[i]>0){
            if((int)negative[List[i]].size()>0){
                List1[negative[List[i]].front()]=i;
                negative[List[i]].pop_front();
            }
            else{
                positive[List[i]].push_back(i);
            }
        }
        if(List[i]<0){
            if((int)positive[-List[i]].size()>0){
                List1[positive[-List[i]].front()]=i;
                positive[-List[i]].pop_front();
            }
            else{
                negative[-List[i]].push_back(i);
            }
        }
    }
    /*
    for(int i=0;i<20;i++){
        cout<<List1[i]<<" ";
    }*/
    return;
}
void modify(int node,int num){
    for(int i=node;i<=N;i+=i&(-i)){
        BIT[i]+=num;
    }
}
long long int query(int node){
    long long int answer=0;
    for(int i=node;i>=1;i-=i&(-i)){
        answer+=BIT[i];
    }
    return answer;
}
long long int count_swaps(vector<int> s){
    pre(s);
    for(int i=1;i<=(int)s.size()+2;i++){
        modify(i,1);
    }
    long long int Count_answer=0;
    for(int i=0;i<(int)s.size();i++){
        if(List1[i]!=0){
            if(s[i]>0) Count_answer+=1;
            //cout<<query(i+1)<<" "<<query(List1[i]+1)<<endl;
            Count_answer+=query(List1[i]+1)-query(i+1)-1;
            //cout<<Count_answer<<" ---"<<endl;
            modify(i+1,1);
            modify(List1[i]+2,-1);
        }
    }
    return Count_answer;
}

Compilation message

vision.cpp:2:10: fatal error: shoes.h: No such file or directory
    2 | #include "shoes.h"
      |          ^~~~~~~~~
compilation terminated.