답안 #22208

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22208 2017-04-29T19:05:00 Z 내일 시험이에요(#1036, pjh0123) 구간들 (KRIII5P_3) C++11
2 / 7
86 ms 2816 KB
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const ll mod = 1000000007;

int n;
pii a[101010];
priority_queue<int, vector<int>, greater<int> > pq;
int c;
int pow2(int x){
    ll t = 2;
    ll r = 1;
    while(x){
        if(x&1){
            r = (r*t)%mod;
        }
        t = (t*t)%mod;
        x/=2;
    }
    return int(r);
}
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d%d",&a[i].first, &a[i].second);
    }
    sort(a,a+n);
    for(int i=0;i<n;i++){
        if(a[i].first >= a[i].second)continue;
        while(!pq.empty() && pq.top() <= a[i].first){
            pq.pop();
        }
        c = (c+pow2(pq.size()))%mod;
        pq.push(a[i].second);
    }
    printf("0 %d\n",c);

}

Compilation message

i.cpp: In function 'int main()':
i.cpp:26:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
i.cpp:28:48: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&a[i].first, &a[i].second);
                                                ^
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 1964 KB Output is partially correct
2 Partially correct 0 ms 1964 KB Output is partially correct
3 Partially correct 0 ms 1964 KB Output is partially correct
4 Partially correct 0 ms 1964 KB Output is partially correct
5 Partially correct 0 ms 1964 KB Output is partially correct
6 Partially correct 3 ms 2104 KB Output is partially correct
7 Partially correct 6 ms 2104 KB Output is partially correct
8 Partially correct 6 ms 2104 KB Output is partially correct
9 Partially correct 3 ms 2104 KB Output is partially correct
10 Partially correct 3 ms 2104 KB Output is partially correct
11 Partially correct 59 ms 2432 KB Output is partially correct
12 Partially correct 66 ms 2432 KB Output is partially correct
13 Partially correct 66 ms 2432 KB Output is partially correct
14 Partially correct 59 ms 2432 KB Output is partially correct
15 Partially correct 59 ms 2432 KB Output is partially correct
16 Partially correct 63 ms 2236 KB Output is partially correct
17 Partially correct 46 ms 2236 KB Output is partially correct
18 Partially correct 53 ms 2236 KB Output is partially correct
19 Partially correct 53 ms 2236 KB Output is partially correct
20 Partially correct 46 ms 2236 KB Output is partially correct
21 Partially correct 66 ms 2432 KB Output is partially correct
22 Partially correct 66 ms 2432 KB Output is partially correct
23 Partially correct 66 ms 2432 KB Output is partially correct
24 Partially correct 86 ms 2432 KB Output is partially correct
25 Partially correct 49 ms 2432 KB Output is partially correct
26 Partially correct 69 ms 2432 KB Output is partially correct
27 Partially correct 63 ms 2432 KB Output is partially correct
28 Partially correct 69 ms 2432 KB Output is partially correct
29 Partially correct 76 ms 2432 KB Output is partially correct
30 Partially correct 63 ms 2432 KB Output is partially correct
31 Partially correct 69 ms 2432 KB Output is partially correct
32 Partially correct 69 ms 2432 KB Output is partially correct
33 Partially correct 66 ms 2432 KB Output is partially correct
34 Partially correct 73 ms 2432 KB Output is partially correct
35 Partially correct 63 ms 2432 KB Output is partially correct
36 Partially correct 66 ms 2432 KB Output is partially correct
37 Partially correct 66 ms 2432 KB Output is partially correct
38 Partially correct 69 ms 2432 KB Output is partially correct
39 Partially correct 69 ms 2432 KB Output is partially correct
40 Partially correct 79 ms 2432 KB Output is partially correct
41 Partially correct 0 ms 1964 KB Output is partially correct
42 Partially correct 0 ms 1964 KB Output is partially correct
43 Partially correct 0 ms 1964 KB Output is partially correct
44 Partially correct 0 ms 1964 KB Output is partially correct
45 Partially correct 26 ms 2432 KB Output is partially correct
46 Partially correct 26 ms 2432 KB Output is partially correct
47 Partially correct 16 ms 2432 KB Output is partially correct
48 Partially correct 49 ms 2816 KB Output is partially correct
49 Partially correct 63 ms 2816 KB Output is partially correct
50 Partially correct 66 ms 2816 KB Output is partially correct