提出 #24357671


ソースコード 拡げる

#pragma GCC optimize("Ofast,unroll-loops")
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;

#ifdef SINA
#define dbg(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << std::endl; }
template <typename Arg1, typename... Args> void __f (const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); }
#define dbg2(x, j, n) cout<< #x << " : "; output((j), (n), x, 1); cout.flush();
#else
#define dbg(...) 0
#define dbg2(x, j, n) 0
#endif
#define SZ(x) ((ll)((x).size()))
#define File(s, t) freopen(s ".txt", "r", stdin); freopen(t ".txt", "w", stdout);
#define input(j, n, a) for (int _i = (j); _i < (n)+(j); _i++) cin>> a[_i];
#define output(j, n, a, t) for (int _i = (j); _i < (n)+(j); _i++) cout<< a[_i] << (((t) && _i != (n)+(j)-1)? ' ' : '\n');
#define kill(x) return cout<< (x) << endl, 0
#define cl const ll
#define fr first
#define sc second
#define lc (v << 1)
#define rc (lc | 1)
#define mid ((l + r) >> 1)
#define All(x) (x).begin(), (x).end()

cl inf = sizeof(ll) == 4 ? (1e9 + 10) : (3e18), mod = 1e9 + 7, MOD = 998244353;

template <class A,class B> ostream& operator << (ostream& out,const pair<A,B>&a){return out<<'('<<a.first<<", "<<a.second<<')';}
template <class A> ostream& operator << (ostream& out, const vector<A> &a) {
	out<< '['; for (int i = -1; ++i < int(a.size());) out<< a[i] << (i + 1 < int(a.size()) ? ", " : ""); return out<<']'; }
template <class T, typename _t = less <T> > using Tree = tree <T, null_type, _t, rb_tree_tag, tree_order_statistics_node_update>;

cl N = 1e5 + 7;

ll a [N], b [N], c [N], n, i1, i2, i3, ans;

int main ()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

	cin>> n;
	input(0, n, a);
	input(0, n, b);
	input(0, n, c);

	sort(a, a + n);
	sort(b, b + n);
	sort(c, c + n);

	for (; i1 < n; i1++, i2++, i3++) {
		while (i2 < n && b[i2] <= a[i1]) i2++;
		while (i3 < n && c[i3] <= b[i2]) i3++;
		if (max({i1, i2, i3}) == n) break;
		if (a[i1] < b[i2] && b[i2] < c[i3]) ans++;
		else break;
	}

	kill(ans);

	cerr<< "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

	return 0;
}
/*

*/

提出情報

提出日時
問題 B - Increasing Triples
ユーザ SinaS
言語 C++ (GCC 9.2.1)
得点 400
コード長 2652 Byte
結果 AC
実行時間 59 ms
メモリ 5972 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 3
AC × 36
セット名 テストケース
Sample 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt
All 01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt, 02_rand_01.txt, 02_rand_02.txt, 02_rand_03.txt, 02_rand_04.txt, 02_rand_05.txt, 02_rand_06.txt, 02_rand_07.txt, 02_rand_08.txt, 02_rand_09.txt, 02_rand_10.txt, 03_rand_dense_01.txt, 03_rand_dense_02.txt, 03_rand_dense_03.txt, 03_rand_dense_04.txt, 03_rand_dense_05.txt, 03_rand_dense_06.txt, 03_rand_dense_07.txt, 03_rand_dense_08.txt, 03_rand_dense_09.txt, 03_rand_dense_10.txt, 04_small_ans_01.txt, 04_small_ans_02.txt, 04_small_ans_03.txt, 04_small_ans_04.txt, 04_small_ans_05.txt, 04_small_ans_06.txt, 04_small_ans_07.txt, 04_small_ans_08.txt, 04_small_ans_09.txt, 04_small_ans_10.txt, 05_handmade_01.txt, 05_handmade_02.txt, 05_handmade_03.txt
ケース名 結果 実行時間 メモリ
01_sample_01.txt AC 5 ms 3596 KiB
01_sample_02.txt AC 2 ms 3548 KiB
01_sample_03.txt AC 2 ms 3596 KiB
02_rand_01.txt AC 59 ms 5812 KiB
02_rand_02.txt AC 58 ms 5896 KiB
02_rand_03.txt AC 58 ms 5908 KiB
02_rand_04.txt AC 57 ms 5904 KiB
02_rand_05.txt AC 56 ms 5808 KiB
02_rand_06.txt AC 56 ms 5972 KiB
02_rand_07.txt AC 55 ms 5916 KiB
02_rand_08.txt AC 58 ms 5908 KiB
02_rand_09.txt AC 58 ms 5916 KiB
02_rand_10.txt AC 57 ms 5924 KiB
03_rand_dense_01.txt AC 39 ms 5920 KiB
03_rand_dense_02.txt AC 34 ms 5904 KiB
03_rand_dense_03.txt AC 37 ms 5812 KiB
03_rand_dense_04.txt AC 36 ms 5932 KiB
03_rand_dense_05.txt AC 39 ms 5884 KiB
03_rand_dense_06.txt AC 39 ms 5936 KiB
03_rand_dense_07.txt AC 34 ms 5880 KiB
03_rand_dense_08.txt AC 32 ms 5908 KiB
03_rand_dense_09.txt AC 42 ms 5864 KiB
03_rand_dense_10.txt AC 38 ms 5920 KiB
04_small_ans_01.txt AC 46 ms 5300 KiB
04_small_ans_02.txt AC 55 ms 5736 KiB
04_small_ans_03.txt AC 54 ms 5768 KiB
04_small_ans_04.txt AC 26 ms 4260 KiB
04_small_ans_05.txt AC 43 ms 5244 KiB
04_small_ans_06.txt AC 4 ms 3628 KiB
04_small_ans_07.txt AC 28 ms 4388 KiB
04_small_ans_08.txt AC 31 ms 4544 KiB
04_small_ans_09.txt AC 4 ms 3656 KiB
04_small_ans_10.txt AC 30 ms 4480 KiB
05_handmade_01.txt AC 53 ms 5804 KiB
05_handmade_02.txt AC 53 ms 5780 KiB
05_handmade_03.txt AC 37 ms 5808 KiB