結果

問題 No.610 区間賞(Section Award)
ユーザー shimarutshimarut
提出日時 2021-05-08 16:50:28
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 269 ms / 2,000 ms
コード長 2,774 bytes
コンパイル時間 3,877 ms
コンパイル使用メモリ 199,016 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2023-10-15 04:21:38
合計ジャッジ時間 9,863 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,356 KB
testcase_02 AC 1 ms
4,356 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,356 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 2 ms
4,352 KB
testcase_17 AC 2 ms
4,352 KB
testcase_18 AC 2 ms
4,352 KB
testcase_19 AC 17 ms
4,348 KB
testcase_20 AC 82 ms
6,284 KB
testcase_21 AC 12 ms
4,356 KB
testcase_22 AC 54 ms
5,188 KB
testcase_23 AC 8 ms
4,348 KB
testcase_24 AC 21 ms
4,356 KB
testcase_25 AC 6 ms
4,356 KB
testcase_26 AC 37 ms
4,592 KB
testcase_27 AC 81 ms
6,064 KB
testcase_28 AC 72 ms
5,796 KB
testcase_29 AC 51 ms
4,888 KB
testcase_30 AC 66 ms
5,448 KB
testcase_31 AC 34 ms
4,396 KB
testcase_32 AC 76 ms
6,032 KB
testcase_33 AC 11 ms
4,356 KB
testcase_34 AC 81 ms
6,364 KB
testcase_35 AC 38 ms
4,524 KB
testcase_36 AC 78 ms
5,976 KB
testcase_37 AC 65 ms
5,756 KB
testcase_38 AC 18 ms
4,352 KB
testcase_39 AC 84 ms
6,540 KB
testcase_40 AC 83 ms
6,332 KB
testcase_41 AC 84 ms
6,236 KB
testcase_42 AC 84 ms
6,252 KB
testcase_43 AC 84 ms
6,496 KB
testcase_44 AC 217 ms
9,468 KB
testcase_45 AC 262 ms
10,768 KB
testcase_46 AC 269 ms
11,008 KB
testcase_47 AC 70 ms
5,828 KB
testcase_48 AC 65 ms
5,452 KB
testcase_49 AC 70 ms
5,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>
#include <sstream>
#include <regex>
#include <fstream>
#include <array>
#include <atcoder/all>

using namespace atcoder;
using mint = modint1000000007;
//using mint = modint998244353;
//using mint = modint;
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using vpint = vector<pint>;
using vvpint = vector<vpint>;
using vmint = vector<mint>;
using vvmint = vector<vmint>;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()

#pragma region GCD
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a % b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region グリッド内チェック
bool out(int x, int y, int h, int w)
{
	if (x < 0 || h <= x || y < 0 || w <= y)return true;
	else return false;
}
#pragma endregion
#pragma region Dijkstra
vl dijkstra(vector<vector<pair<int, ll>>> v, int s)
{
	ll INF = 1e18;
	int MAX = 1e6;
	vl res(MAX, INF);
	priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> q;
	q.push({ 0,s });
	while (!q.empty())
	{
		int now;
		ll d;
		tie(d, now) = q.top();
		q.pop();
		if (!chmin(res[now], d))continue;
		for (auto p : v[now])
		{
			int next;
			ll c;
			tie(next, c) = p;
			if (res[next] <= res[now] + c)continue;
			q.push({ res[now] + c,next });
		}
	}
	return res;
}
#pragma endregion
#pragma endregion


int main()
{
	int n; cin >> n;
	vpint a(n), b(n);
	rep(i, n)
	{
		cin >> a[i].first;
		a[i].second = i;
	}
	rep(i, n)
	{
		cin >> b[i].first;
		b[i].second = i;
	}
	sort(all(a));
	sort(all(b));
	vector<tuple<int,int,int>> v(n);
	rep(i, n)
	{
		v[i] = { a[i].second,b[i].second,a[i].first };
	}
	sort(rall(v));
	fenwick_tree<int> fw(n + 1);
	set<int> res;
	rep(i, n)
	{
		int g = get<1>(v[i]);
		int id = get<2>(v[i]);
		if (fw.sum(0, g) == 0)res.insert(id);
		fw.add(g, 1);
	}
	for (int x : res)cout << x << endl;
}
0