QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#662983 | #4423. AMPPZ in the times of disease | ucup-team3474 | WA | 2940ms | 10552kb | C++20 | 1022b | 2024-10-21 12:09:06 | 2024-10-21 12:09:08 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1919810;
typedef long long ll;
typedef pair<ll,ll> PII;
ll n,m,k;
ll a[N],b[N];
char s[N];
bool tf[N];
int res[N];
void __(){
cin>>n>>m;
for(int i=1;i<=n;i++){
res[i]=m;
}
for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
vector<PII> v;
v.push_back({a[1],b[1]});
res[1]=1;
for(int i=2;i<m;i++){
ll dist=1e19,t=0;
for(int j=1;j<=n;j++){
if(res[j]!=m) continue;
ll mn=0;
for(auto [x,y]:v){
ll res=(x-a[j])*(x-a[j])+(y-b[j])*(y-b[j]);
mn=max(mn,res);
}
if(mn<=dist){
dist=mn;
t=j;
}
}
v.push_back({a[t],b[t]});
res[t]=i;
}
// cout<<n<<" "<<m<<endl;
for(int i=1;i<=n;i++) printf("%d ",res[i]);
printf("\n");
}
int main(){
int _;
cin>>_;
while(_--){
__();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2940ms
memory: 10552kb
input:
100 100000 20 270505 510725 245104 76414 131477 992924 781607 895592 562469 622976 564354 637966 980036 112090 522903 687218 113871 977855 6615 123673 13847 347618 657794 165707 420561 183995 11367 136391 507836 694877 985069 105115 774110 486921 14319 338715 774937 118145 981468 99089 803866 491315...
output:
1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2...
result:
wrong answer wrong solution (test case 1)