QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#937023 | #1292. Circuit Board Design | KimeyJ | WA | 1ms | 4480kb | C++20 | 1.6kb | 2025-03-16 05:44:09 | 2025-03-16 05:44:11 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define forr(i, a, b) for(ll i = (ll) a; i < (ll) b; i++)
#define forn(i, n) forr(i, 0, n)
#define dforr(i,a,b) for(int i=int(b)-1;i>=int(a);--i)
#define dforn(i,n) for(int i = n-1; i>=0; i--)
#define pb push_back
#define fst first
#define snd second
#define ln '\n'
#define sz(c) ((int)c.size())
#define zero(v) memset(v, 0, sizeof(v))
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll MOD = 1e9 + 7;
const ll MAXN = 1009;
const ll INF = 9e18;
const ld EPS = 1e-9;
vi g[MAXN];
pair<double,double> pos[MAXN];
int vis[MAXN];
const double PI = acos(-1);
int cont = 1;
int n;
void dfs(int u) {
vis[u] = 1;
int cant = 0;
for(auto v : g[u]) if (!vis[v]) cant++;
if (cant == 0) return;
for(auto v : g[u]) {
if (!vis[v]) {
double nX = pos[u].fst+cos(cont*PI/n);
double nY = pos[u].fst+sin(cont*PI/n);
pos[v] = {nX,nY};
cont++;
dfs(v);
//if (pari%2 == 0) dx = dx - paso, pari++;
//else dx = dx * (-1.0), pari++;
}
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
//freopen("input.txt","r",stdin);
cin >> n;
forn(_,n-1) {
int u,v;
cin >> u >> v;
u--; v--;
g[u].pb(v);
g[v].pb(u);
}
pos[0] = {0.0,0.0};
dfs(0);
forn(i,n) cout << setprecision(12) << fixed << pos[i].fst << " " << pos[i].snd << ln;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 4480kb
input:
1000 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 ...
output:
0.000000000000 0.000000000000 0.999995065202 0.003141587486 1.999975326058 1.006278209167 2.999930913167 2.009399964491 3.999851957371 3.012496953050 4.999728589852 4.015559274683 5.999550942233 5.018577029568 6.999309146670 6.021540318326 7.998993335954 7.024439242114 8.998593643604 8.027263902724 ...
result:
wrong answer Length of edge 2 incorrect: nan.