| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 84005 | ekrem | Port Facility (JOI17_port_facility) | C++98 | 2 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define N 1000005
using namespace std;
int n, fen1[N], fen2[N];
pair < int , int > x[N];
long long ans = 1;
void up1(int x, int y){
for(; x <= n+n; x += x&-x)
fen1[x] += y;}
int qu1(int x){
int top = 0;
for(; x > 0; x -= x&-x)
top += fen1[x];
return top;}
void up2(int x, int y){
for(; x <= n+n; x += x&-x)
fen2[x] += y;}
int qu2(int x){
int top = 0;
for(; x > 0; x -= x&-x)
top += fen2[x];
return top;}
int main() {
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
scanf("%d",&n);
for(int i = 1; i <= n; i++)
scanf("%d %d",&x[i].st ,&x[i].nd);
sort(x + 1, x + n + 1);
for(int i = 1; i <= n; i++){
int q1 = qu1(x[i].nd) - qu1(x[i].st);
int q2 = qu2(x[i].nd) - qu2(x[i].st);
if(q1 and q2){
ans = 0;
break;
}
if(!q1 and !q2)
ans = ans*2%mod;
if(!q1){
up1(x[i].nd, 1);
} else
up2(x[i].nd, 1);
}
printf("%lld\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
