QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#376452 | #7680. Subway | arnold518 | WA | 0ms | 3732kb | C++17 | 1.5kb | 2024-04-04 10:13:45 | 2024-04-04 10:13:46 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 50;
const int P = 1e3;
const int Q = 1e9-1e4;
struct Data
{
int x, y, k;
};
int N, K;
Data A[MAXN+10];
int B;
int main()
{
scanf("%d", &N);
for(int i=1; i<=N; i++) scanf("%d%d%d", &A[i].x, &A[i].y, &A[i].k), K=max(K, A[i].k);
vector<int> V;
for(int i=1; i<=N; i++) for(int j=i+1; j<=N; j++)
{
int x1=A[i].x, y1=A[i].y, x2=A[i].x, y2=A[i].y;
if(x1==x2) continue;
if(((y2-y1)*(-3*P-x1))%(x2-x1)==0)
{
int y=(y2-y1)*(-3*P-x1)/(x2-x1)+y1;
if(-P<=y && y<=P) V.push_back(y);
}
}
sort(V.begin(), V.end());
for(int i=0; i<P; i++)
{
if(!binary_search(V.begin(), V.end(), i)) { B=i; break; }
if(!binary_search(V.begin(), V.end(), -i)) { B=-i; break; }
}
printf("%d\n", K);
for(int i=1; i<=K; i++)
{
vector<pii> V;
for(int j=1; j<=N; j++)
{
if(A[j].k>=i)
{
int y=(ll)(A[j].y-B)*(Q+i-(-3*P))/(A[j].x-(-3*P))+B;
V.push_back({y, j});
}
}
sort(V.begin(), V.end());
printf("%d ", V.size()*3);
for(auto [y, j] : V)
{
printf("%d %d ", Q+i, y);
printf("%d %d ", A[j].x, A[j].y);
printf("%d %d ", Q+i, y+1);
}
printf("\n");
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3732kb
input:
3 1 2 1 2 1 2 3 3 2
output:
2 9 999990001 333108 2 1 999990001 333109 999990001 666439 1 2 999990001 666440 999990001 998994 3 3 999990001 998995 6 999990002 333108 2 1 999990002 333109 999990002 998994 3 3 999990002 998995
result:
wrong answer Polyline 2 intersects with previous polylines.