Submission #6926174


Source Code Expand

Copy
#include <bits/stdc++.h>
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define DEC(i, a, b) for (int i = (a); i > (b); --i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
typedef long long ll;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
const ll LINF = (int)1e18;
const double EPS = 1e-9;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  const int N_MAX = 510;
  const int M_MAX = 200010;

  int N,M,Q;
  cin>>N>>M>>Q;
  vector<int> L(M_MAX,0),R(M_MAX,0);
  
  int X[N_MAX][N_MAX],C[N_MAX][N_MAX];
  fill(X[0],X[N_MAX-1],0);
  fill(C[0],C[N_MAX-1],0);

  FOR(i,1,M+1) {
    cin>>L[i]>>R[i];
    ++X[L[i]][R[i]];
  }
  FOR(i,1,N+1)
    FOR(j,1,N+1) C[i][j] = C[i][j-1] + X[i][j];

  REP(i,Q) {
    int p,q;
    cin>>p>>q;
    int sum = 0;
    FOR(j,p,q+1) sum += C[j][q] - C[j][p-1];
    cout << sum << endl;
  }

  return 0;
}

Submission Info

Submission Time
Task D - AtCoder Express 2
User aximov
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1070 Byte
Status
Exec Time 301 ms
Memory 8192 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
× 3
× 13
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 4 ms 7424 KB
in02.txt 4 ms 7424 KB
in03.txt 4 ms 7424 KB
in04.txt 4 ms 7424 KB
in05.txt 261 ms 7936 KB
in06.txt 269 ms 7936 KB
in07.txt 267 ms 7936 KB
in08.txt 265 ms 7936 KB
in09.txt 258 ms 7680 KB
in10.txt 301 ms 8192 KB
sample_01.txt 4 ms 7424 KB
sample_02.txt 4 ms 7424 KB
sample_03.txt 4 ms 7424 KB