AtCoder Beginner Contest 106

Submission #3040635

Source codeソースコード

#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
int main()
{
  int res,p,q,N,M,Q,L[200001],R[200001],sum[501][501];
  cin >> N >> M >> Q;
  REP(i,M)cin >> L[i] >> R[i];
  REP(i,501)REP(j,501)sum[i][j] = 0;
  REP(i,M)sum[L[i]][R[i]]++;
  for(int i=1;i<=N;i++)
    for(int j=1;j<=N;j++){
      sum[i][j] += sum[i][j-1];
    }
  REP(i,Q){
    res = 0;
    cin >> p >> q;
    for(int i=p;i<=q;i++)
      res += sum[i][q]-sum[i][p-1];
    cout << res << endl;
  }
}

Submission

Task問題 D - AtCoder Express 2
User nameユーザ名 mak
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 400
Source lengthソースコード長 937 Byte
File nameファイル名
Exec time実行時間 394 ms
Memory usageメモリ使用量 3456 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
All 400 / 400 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
in01.txt AC 2 ms 1280 KB
in02.txt AC 2 ms 1280 KB
in03.txt AC 2 ms 1280 KB
in04.txt AC 2 ms 1280 KB
in05.txt AC 378 ms 3456 KB
in06.txt AC 390 ms 3328 KB
in07.txt AC 378 ms 3328 KB
in08.txt AC 378 ms 3328 KB
in09.txt AC 365 ms 2944 KB
in10.txt AC 394 ms 3456 KB
sample_01.txt AC 2 ms 1280 KB
sample_02.txt AC 2 ms 1280 KB
sample_03.txt AC 2 ms 1280 KB