Submission #3889425
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pll; #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i)) #define REP(i, n) FOR(i, n, 0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll)1e15; struct Time { ll s; ll t; int i; }; Time T[100005]; int C[100005]; int main() { int N; cin >> N; REP(i, N) { cin >> T[i].s >> T[i].t; T[i].i = i; C[i] = 0; } sort(T, T + N, [](Time a, Time b) { return a.s > b.s; }); REP(i, N) { Time t = T[i]; int ok = i, ng = -1; while (abs(ok - ng) > 1) { ll mid = (ok + ng) / 2; if (T[mid].s < t.t) { ok = mid; } else { ng = mid; } } C[t.i] = i - ok; } REP(i, N) { cout << C[i] << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - How are you? |
User | coco18000 |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 1032 Byte |
Status | AC |
Exec Time | 236 ms |
Memory | 3584 KB |
Judge Result
Set Name | Sample | Dataset1 | Dataset2 | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 30 / 30 | 70 / 70 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt |
Dataset1 | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt |
Dataset2 | 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 1 ms | 256 KB |
01-02.txt | AC | 1 ms | 256 KB |
01-03.txt | AC | 1 ms | 256 KB |
01-04.txt | AC | 1 ms | 256 KB |
01-05.txt | AC | 2 ms | 256 KB |
01-06.txt | AC | 3 ms | 256 KB |
01-07.txt | AC | 5 ms | 256 KB |
01-08.txt | AC | 5 ms | 256 KB |
01-09.txt | AC | 5 ms | 256 KB |
01-10.txt | AC | 5 ms | 256 KB |
02-01.txt | AC | 6 ms | 256 KB |
02-02.txt | AC | 12 ms | 384 KB |
02-03.txt | AC | 113 ms | 1920 KB |
02-04.txt | AC | 232 ms | 3456 KB |
02-05.txt | AC | 236 ms | 3584 KB |
02-06.txt | AC | 223 ms | 3584 KB |
02-07.txt | AC | 223 ms | 3200 KB |
sample-01.txt | AC | 1 ms | 256 KB |
sample-02.txt | AC | 1 ms | 256 KB |