QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#514455 | #1173. Knowledge Is... | wyhao | WA | 1ms | 5996kb | C++14 | 707b | 2024-08-11 01:45:16 | 2024-08-11 01:45:18 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=300005;
int n,m;
struct node{
int x,y,id;
}p[N];
bool cmp1(node x,node y){
return x.y<y.y;
}
bool cmp2(node x,node y){
return x.x<y.x;
}
int ans[N];
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
scanf("%d%d",&p[i].x,&p[i].y);
p[i].id=i;
}
sort(p+1,p+n+1,cmp1);
sort(p+m+1,p+n+1,cmp2);
int j=m+1;
for(int i=1;i<=m;i++){
if(j<=n and p[j].x<=p[i].y) j++;
if(j>n) break;
ans[p[j].id] = i;
j++;
}
for(int i=1;i<=m;i++) ans[p[i].id] = i;
for(int i=1;i<=n;i++){
printf("%d ",ans[i]);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5996kb
input:
7 5 9 10 7 9 3 4 9 10 2 6 8 9 5 8
output:
1 4 1 2 2 5 3
result:
ok answer = 7
Test #2:
score: 0
Accepted
time: 1ms
memory: 5996kb
input:
2 2 1 2 3 4
output:
1 2
result:
ok answer = 2
Test #3:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
2 1 1 2 2 3
output:
1 0
result:
ok answer = 1
Test #4:
score: 0
Accepted
time: 1ms
memory: 5844kb
input:
1 1 4 26
output:
1
result:
ok answer = 1
Test #5:
score: -100
Wrong Answer
time: 1ms
memory: 5860kb
input:
500 258 1 3 3 5 2 4 3 5 4 5 4 5 1 4 1 2 3 5 2 5 2 5 4 5 4 5 4 5 2 3 1 4 1 4 1 4 4 5 4 5 2 3 4 5 3 5 3 5 1 5 1 4 2 5 1 5 3 5 3 4 4 5 2 3 3 5 3 5 4 5 2 3 1 5 1 5 2 3 2 3 3 4 3 5 3 4 1 3 1 2 1 5 4 5 2 3 2 4 1 3 4 5 4 5 4 5 1 3 3 5 4 5 3 5 1 5 1 2 1 2 3 5 3 5 4 5 3 4 3 5 2 3 2 5 2 4 2 5 3 5 2 3 1 5 4 5 ...
output:
83 0 251 46 136 131 239 27 0 34 33 135 0 132 93 168 207 206 134 0 96 133 0 45 7 194 0 0 47 192 0 91 44 0 0 77 0 0 85 84 195 0 197 89 15 18 139 80 189 79 0 138 0 115 0 0 37 0 1 7 48 0 137 209 49 110 32 210 0 38 106 14 147 170 171 102 0 173 0 146 0 176 28 33 36 145 0 167 179 143 0 182 184 140 61 186 1...
result:
wrong answer Interval intersecting