Submission #2207697
Source Code Expand
#include <bits/stdc++.h> using namespace std; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; //math //------------------------------------------- template<class T> inline T sqr(T x) {return x*x;} typedef long long LL; const LL mod=1000000007; #define MAX 10000 const double PI = acos(-1.0); //------------------------------------------- const int N = 123456; int a[N], b[N], c[N]; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N,cnta=0,cntc=0; LL ans; cin >> N; REP(i, N){ cin >> a[i];} REP(i, N){ cin >> b[i];} REP(i, N){ cin >> c[i];} sort(a, a+N); sort(b, b+N); sort(c, c+N); REP(i, N){ LL numa = lower_bound(a, a + N, b[i]) - a ; LL numc = N - (upper_bound(c, c + N,b[i] ) - c) ; ans += numa * numc; } cout << ans; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Snuke Festival |
User | DSMM |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1756 Byte |
Status | AC |
Exec Time | 58 ms |
Memory | 1408 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 57 ms | 1408 KB |
02.txt | AC | 57 ms | 1408 KB |
03.txt | AC | 52 ms | 1408 KB |
04.txt | AC | 53 ms | 1408 KB |
05.txt | AC | 40 ms | 1408 KB |
06.txt | AC | 40 ms | 1408 KB |
07.txt | AC | 35 ms | 1408 KB |
08.txt | AC | 35 ms | 1408 KB |
09.txt | AC | 30 ms | 1408 KB |
10.txt | AC | 30 ms | 1408 KB |
11.txt | AC | 28 ms | 1408 KB |
12.txt | AC | 28 ms | 1408 KB |
13.txt | AC | 53 ms | 1408 KB |
14.txt | AC | 55 ms | 1408 KB |
15.txt | AC | 51 ms | 1408 KB |
16.txt | AC | 52 ms | 1408 KB |
17.txt | AC | 54 ms | 1408 KB |
18.txt | AC | 53 ms | 1408 KB |
19.txt | AC | 58 ms | 1408 KB |
20.txt | AC | 26 ms | 1408 KB |
21.txt | AC | 26 ms | 1408 KB |
22.txt | AC | 39 ms | 1408 KB |
23.txt | AC | 51 ms | 1408 KB |
24.txt | AC | 52 ms | 1408 KB |
25.txt | AC | 53 ms | 1408 KB |
26.txt | AC | 1 ms | 256 KB |
27.txt | AC | 1 ms | 256 KB |
28.txt | AC | 1 ms | 256 KB |
29.txt | AC | 1 ms | 256 KB |
s1.txt | AC | 3 ms | 384 KB |
s2.txt | AC | 1 ms | 256 KB |
s3.txt | AC | 1 ms | 256 KB |