# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
22207 | 내일 시험이에요 (#42) | 구간들 (KRIII5P_3) | C++11 | 0 ms | 1964 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |