| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1329056 | Faisal_Saqib | Drzava (COCI15_drzava) | C++20 | 149 ms | 131072 KiB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef long double ld;
int n,k;
bool win=0;
const int N=1e5,K=31;
bool pos[N][K];
int par[N];
bool np[K];
int get(int x)
{
return (par[x]==x)?x:par[x]=get(par[x]);
}
void merge(int x,int y)
{
x=get(x);
y=get(y);
if(x==y)return;
par[x]=y;
for(int i=0;i<k;i++)
{
for(int j=0;j<k;j++)
{
np[(i+j)%k]|=(pos[x][i]&pos[y][j]);
}
}
for(int j=0;j<k;j++)
{
pos[y][j]|=np[j];
pos[y][j]|=pos[x][j];
np[j]=0;
}
win|=(pos[y][0]);
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>k;
vector<array<ld,3>> a,edge;
for(int i=0;i<n;i++)
{
ld x,y,kt;
cin>>x>>y>>kt;
a.push_back({x,y,kt});
par[i]=i;
pos[i][(ll)(kt)%k]=1;
}
for(int i=0;i<n;i++)
{
for(int j=0;j<i;j++)
{
edge.push_back({((a[i][0]-a[j][0])*(a[i][0]-a[j][0])+(a[i][1]-a[j][1])*(a[i][1]-a[j][1])),i,j});
}
}
sort(begin(edge),end(edge));
for(auto cur:edge)
{
merge(cur[1],cur[2]);
// {
if(win)
{
ld sq=sqrtl(cur[0]);
cout<<fixed<<setprecision(3)<<round(sq*1000)/1000<<endl;
return 0;
}
// }
}
// sort(begin(a),end(a));
// for(auto x:a)
// {
// cout<<x[0]<<' '<<x[1]<<' '<<x[2]<<endl;
// }
}컴파일 시 표준 에러 (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... | ||||
| # | 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... | ||||
| # | 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... | ||||
| # | 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... | ||||
| # | 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... | ||||
