Submission #9819064
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define rep(i, n) for(int i=0; i<n; i++) #define rrep(i, n) for(int i=n-1; i>=0; i--) #define FOR(i, a, b) for(int i=a; i<b; i++) #define ALL(v) v.begin(),v.end() typedef long long ll; typedef pair<int, int> pii; typedef pair<int, ll> pil; typedef pair<ll, int> pli; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LLINF = 1e18; const ll MOD = 1e9+7; const double EPS = 1e-10; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } int a[505][505]; int main() { int N, M, Q; cin >> N >> M >> Q; for (int i = 0; i < M; i++) { int l, r; cin >> l >> r; a[r][l] += 1; } for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { a[i][j] += a[i][j-1]; } } for (int i = 0; i < Q; i++) { int p, q; cin >> p >> q; int sum = 0; for (int j = p; j <= q; j++) { sum += a[j][q] - a[j][p-1]; } cout << sum << endl; } }
Submission Info
Submission Time | |
---|---|
Task | D - AtCoder Express 2 |
User | bokeh |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1167 Byte |
Status | AC |
Exec Time | 410 ms |
Memory | 1920 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in01.txt | AC | 1 ms | 256 KB |
in02.txt | AC | 1 ms | 256 KB |
in03.txt | AC | 1 ms | 256 KB |
in04.txt | AC | 1 ms | 256 KB |
in05.txt | AC | 374 ms | 1792 KB |
in06.txt | AC | 378 ms | 1792 KB |
in07.txt | AC | 375 ms | 1792 KB |
in08.txt | AC | 380 ms | 1792 KB |
in09.txt | AC | 363 ms | 1408 KB |
in10.txt | AC | 410 ms | 1920 KB |
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |