AtCoder Beginner Contest 014

Submission #1069807

Source codeソースコード

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vi accum(1e6 + 10, 0);
  int a, b;
  rep (i, n) {
    scanf("%d %d", &a, &b);
    b += 1;
    accum[a] += 1;
    accum[b] -= 1;
  }

  vll sum(1e6 + 10, 0);
  sum[0] = accum[0];
  ll ans = sum[0];
  FOR (i, 1, 1e6+1) {
    sum[i] = sum[i-1] + accum[i];
    ans = max(ans, sum[i]);
  }
  printf("%lld\n", ans);

  return 0;
}

Submission

Task問題 C - AtColor
User nameユーザ名 cyglef
Created time投稿日時
Language言語 C++11 (GCC 4.8.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 1288 Byte
File nameファイル名
Exec time実行時間 60 ms
Memory usageメモリ使用量 12576 KB

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:40:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
./Main.cpp:44:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &a, &b);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - subtask0_sample01.txt,subtask0_sample02.txt
Subtask1 30 / 30 subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask0_sample01.txt,subtask0_sample02.txt
Subtask2 70 / 70 subtask0_sample01.txt,subtask0_sample02.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask2_09.txt,subtask2_10.txt,subtask2_11.txt,subtask2_12.txt,subtask2_13.txt,subtask2_14.txt,subtask2_15.txt,subtask2_16.txt,subtask2_17.txt,subtask2_18.txt,subtask2_19.txt,subtask2_20.txt,subtask2_21.txt,subtask2_22.txt,subtask2_23.txt,subtask2_24.txt,subtask2_25.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
subtask0_sample01.txt AC 38 ms 12440 KB
subtask0_sample02.txt AC 36 ms 12444 KB
subtask1_01.txt AC 35 ms 12576 KB
subtask1_02.txt AC 38 ms 12448 KB
subtask1_03.txt AC 38 ms 12560 KB
subtask1_04.txt AC 38 ms 12444 KB
subtask1_05.txt AC 37 ms 12404 KB
subtask1_06.txt AC 38 ms 12524 KB
subtask1_07.txt AC 38 ms 12448 KB
subtask1_08.txt AC 37 ms 12448 KB
subtask1_09.txt AC 38 ms 12404 KB
subtask1_10.txt AC 38 ms 12448 KB
subtask1_11.txt AC 37 ms 12408 KB
subtask1_12.txt AC 39 ms 12444 KB
subtask1_13.txt AC 37 ms 12404 KB
subtask1_14.txt AC 38 ms 12572 KB
subtask1_15.txt AC 38 ms 12448 KB
subtask2_01.txt AC 53 ms 12456 KB
subtask2_02.txt AC 56 ms 12448 KB
subtask2_03.txt AC 53 ms 12448 KB
subtask2_04.txt AC 55 ms 12444 KB
subtask2_05.txt AC 54 ms 12448 KB
subtask2_06.txt AC 59 ms 12448 KB
subtask2_07.txt AC 56 ms 12448 KB
subtask2_08.txt AC 59 ms 12448 KB
subtask2_09.txt AC 58 ms 12448 KB
subtask2_10.txt AC 58 ms 12428 KB
subtask2_11.txt AC 56 ms 12448 KB
subtask2_12.txt AC 55 ms 12448 KB
subtask2_13.txt AC 56 ms 12452 KB
subtask2_14.txt AC 56 ms 12444 KB
subtask2_15.txt AC 58 ms 12440 KB
subtask2_16.txt AC 58 ms 12456 KB
subtask2_17.txt AC 58 ms 12448 KB
subtask2_18.txt AC 55 ms 12452 KB
subtask2_19.txt AC 57 ms 12448 KB
subtask2_20.txt AC 60 ms 12400 KB
subtask2_21.txt AC 58 ms 12448 KB
subtask2_22.txt AC 58 ms 12448 KB
subtask2_23.txt AC 57 ms 12452 KB
subtask2_24.txt AC 57 ms 12436 KB
subtask2_25.txt AC 55 ms 12448 KB