/ SeriousOJ /

Record Detail

Compile Error

foo.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.

Code

#include <iostream>
#include <cstdio>
#include<list>
#include<iomanip>
#include<cmath>
#include<queue>
#include <functional>
#include<stdio.h>
#include<assert.h>
#include<stack>
#include<sstream>
#include <cstdlib>
#include<map>
#include<algorithm>
#include<set>
#include<utility>
#include<memory.h>
#include<string>
#include<vector>
#include<numeric>
#include <bitset>
using namespace std;
#define ll  long long
#define pb push_back
#define fi(ss) freopen (ss,"r",stdin)
#define fo(ss) freopen (ss,"w",stdout)
#define sz(v)               ((ll)((v).size()))
#define all(x)          (x).begin(),(x).end()
#define rep(i, v)       for(ll i=0;i<sz(v);i++)
#define lp(i,n) for(ll i = 0 ; i < n ; ++i)
#define lpab(i, a, b) for(ll i = a; i <= b; i++)
#define lpba(i, b, a) for(ll i = b; i >= a; i--)
#define hash ___hash
#define next ___next
#define prev ___prev
#define left ___left
#define time __time
typedef pair<ll, ll> pii;
#define F first
#define S second
#define MP make_pair
#define vi vector<ll>
#define vvi vector<vi>
#define vpii vector<pii>
#define mpii map<ll, ll> 
#define mpsi map<string, ll>
#define vs vector<string>
#define ld long double
#define vd vector<ld>
#define pie acos(-1)
const ll maxn = 4 * 100005;
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define txtio   freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define OO 1e18

int main()
{
	ll n;
	cin >> n;
	vpii v(n);
	lp(i, n)
	{
		ll a;
		cin >> a;
		v[i] = MP(a, i + 1);
	}
	ll q;
	sort(all(v));
	cin >> q;
	while (q--)
	{
		ll a;
		cin >> a;
		cout << v[0].second << endl;
		pii p = MP(a, v[0].second);
		v.erase(v.begin());
		ll l = 0, r = n - 2;
		ll ind = -1;
		while (l <= r)
		{
			ll mid = (l + r) / 2;
			ll num = v[mid].first;
			if (num > a)
			{
				r = mid - 1;
			}
			else if (num < a)
			{
				l = mid + 1;
			}
			else
			{
				ind = mid;
				break;
			}
		}
		if (ind == -1)
			v.insert(v.begin() + r, p);
		else
			v.insert(v.begin() + ind, p);
	}
	return 0;
}

Information

Submit By
Type
Submission
Problem
P1086 KuZ the Position
Language
C99 (GCC 13.2.0)
Submit At
2024-09-04 17:31:01
Judged At
2024-11-11 03:04:27
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes