Submission #22206

# Submission time Handle Problem Language Result Execution time Memory
22206 2017-04-29T18:59:00 Z 내일 시험이에요(#1036, pjh0123) None (KRIII5P_3) C++
0 / 7
0 ms 2724 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);
                                                ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2724 KB Output isn't correct
2 Halted 0 ms 0 KB -