# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22205 | 내일 시험이에요 (#42) | 구간들 (KRIII5P_3) | C++11 | 0 ms | 1964 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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++){
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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |