Submission #1045569

# Submission time Handle Problem Language Result Execution time Memory
1045569 2024-08-06T05:51:39 Z vjudge1 Rectangles (IOI19_rect) C++17
Compilation error
0 ms 0 KB
#include "shoes.h"
#include<bits/stdc++.h>
using namespace std;
queue<int> otherpos[100100];
void Add(int x){
while(x<100100)
T[x]++,x+=x&-x;
}
int Qry(int x){
int ans=0;
while(x)
ans+=T[x],x-=x&-x;
return ans;
}
long long calc(vector<int>v){
    long long ans=0;
    int K=0;
    for(auto i:v) {
        Add(i);
        ans+=K++-Qry(i);
    }
    return ans;
}
long long count_swaps(std::vector<int> s) {
    long long ans=0;
    int n=s.size()>>1;
    vector<int>sup;
    int CC=0;
    for(int i=0;i<n*2;i++) if(s[i]<0)
        otherpos[-s[i]].push(i);
    CC=0;
	vector<pair<int,int>> thgs;
    for(int i=0;i<n*2;i++) if(s[i]>0) {
        int x=otherpos[s[i]].front();
		thgs.push_back({x,i});
        otherpos[s[i]].pop();
    }
	for(auto&[i,j]:thgs)
		if(i>j)
			ans++,swap(i,j);
	sort(thgs.begin(),thgs.end());
	for(auto[i,j]:thgs)
		sup.push_back(i),
		sup.push_back(j);
    return ans+calc(sup);
}

Compilation message

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