Japan Alumni Group Summer Camp 2013 Warming Up

Submission #1152633

Source codeソースコード

#include <iostream>
#include <map>
#include <algorithm>

using ll = long long;

std::pair<ll,ll> a[1000000] = {};


using namespace std;
int main(void){
    // Here your code !
    
    ll n,m;
    cin >> n >> m;
    
    for(int i = 0; i < n; i++){
        ll s , t;
        cin >> s >> t;
        
        if(s > t){
            t += m;
        }
        
        a[i].first = t;
        a[i].second = s;
    }
    
    sort(a,a+n);
    
    ll tmp = a[0].second + m;
    ll tmp2 = a[0].first;
    ll tmp3 = 1;
    
    for(; tmp3 < n; tmp3++){
        if(a[tmp3].second + m == tmp){
            tmp2 = a[tmp3].first;
        }else{
            break;
        }
    }
    
    ll res = 1;
    
    for(int i = tmp3; i < n; i++){
        //cout << a[i].first << " " << a[i].second << endl;
        
        if(tmp2 <= a[i].second && tmp >= a[i].first){
            tmp2 = a[i].first;
            
            res++;
        }
    }    
    
    cout << res << endl;
}

Submission

Task問題 A - Anime Master
User nameユーザ名 nasatame
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1025 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
All 0 / 100 1,10,11,12,13,14,15,16,17,18,19,2,20,21,22,23,24,25,26,27,28,29,3,30,31,32,33,34,35,36,37,38,39,4,40,41,42,43,44,45,46,47,48,49,5,50,51,52,53,54,55,56,57,58,59,6,60,61,62,63,64,65,66,67,68,69,7,70,71,72,73,74,75,76,77,78,79,8,80,81,82,83,84,85,86,87,88,89,9

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
1 AC 6 ms 15872 KB
10 AC 6 ms 15872 KB
11 AC 6 ms 15872 KB
12 AC 6 ms 15872 KB
13 AC 6 ms 15872 KB
14 AC 6 ms 15872 KB
15 AC 6 ms 15872 KB
16 AC 6 ms 15872 KB
17 AC 6 ms 15872 KB
18 AC 6 ms 15872 KB
19 AC 6 ms 15872 KB
2 AC 6 ms 15872 KB
20 AC 6 ms 15872 KB
21 AC 6 ms 15872 KB
22 AC 6 ms 15872 KB
23 AC 6 ms 15872 KB
24 AC 6 ms 15872 KB
25 AC 6 ms 15872 KB
26 AC 6 ms 15872 KB
27 AC 6 ms 15872 KB
28 AC 6 ms 15872 KB
29 AC 6 ms 15872 KB
3 AC 6 ms 15872 KB
30 AC 6 ms 15872 KB
31 AC 6 ms 15872 KB
32 AC 6 ms 15872 KB
33 AC 6 ms 15872 KB
34 AC 6 ms 15872 KB
35 AC 6 ms 15872 KB
36 AC 6 ms 15872 KB
37 AC 6 ms 15872 KB
38 AC 6 ms 15872 KB
39 AC 6 ms 15872 KB
4 AC 6 ms 15872 KB
40 AC 6 ms 15872 KB
41 AC 6 ms 15872 KB
42 AC 6 ms 15872 KB
43 AC 6 ms 15872 KB
44 AC 6 ms 15872 KB
45 AC 6 ms 15872 KB
46 AC 6 ms 15872 KB
47 AC 6 ms 15872 KB
48 AC 6 ms 15872 KB
49 AC 6 ms 15872 KB
5 AC 6 ms 15872 KB
50 AC 6 ms 15872 KB
51 AC 6 ms 15872 KB
52 AC 6 ms 15872 KB
53 AC 6 ms 15872 KB
54 AC 6 ms 15872 KB
55 AC 6 ms 15872 KB
56 AC 6 ms 15872 KB
57 AC 6 ms 15872 KB
58 AC 66 ms 15872 KB
59 AC 62 ms 15872 KB
6 AC 6 ms 15872 KB
60 AC 69 ms 15872 KB
61 WA
62 WA
63 WA
64 AC 73 ms 15872 KB
65 AC 24 ms 15872 KB
66 AC 39 ms 15872 KB
67 AC 26 ms 15872 KB
68 WA
69 AC 6 ms 15872 KB
7 AC 6 ms 15872 KB
70 AC 8 ms 15872 KB
71 AC 6 ms 15872 KB
72 AC 6 ms 15872 KB
73 AC 6 ms 15872 KB
74 AC 7 ms 15872 KB
75 AC 8 ms 15872 KB
76 AC 10 ms 15872 KB
77 AC 8 ms 15872 KB
78 WA
79 WA
8 AC 6 ms 15872 KB
80 WA
81 WA
82 WA
83 WA
84 WA
85 WA
86 WA
87 WA
88 WA
89 WA
9 AC 6 ms 15872 KB