QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#602651#7680. SubwayetherealUnicornWA 0ms3612kbC++142.1kb2024-10-01 11:35:282024-10-01 11:35:29

Judging History

你现在查看的是最新测评结果

  • [2024-10-01 11:35:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2024-10-01 11:35:28]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 53;
const int INF = 8e8;
const int nx = 10001;
const int ny = 2;

struct Station
{
    ll x, y;
    int cnt;
    ll prex, prey;
    ll sufx, sufy;
};

Station st[N];
vector<int> tmp;

bool cmp(Station a, Station b) { return make_pair(a.x, a.y) < make_pair(b.x, b.y); }

int main()
{
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n, maxcnt = 0;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> st[i].x >> st[i].y >> st[i].cnt;
        st[i].prex = st[i].x + 1 + ny * (INF / nx);
        st[i].prey = st[i].y - (nx / ny + 1) - nx * (INF / nx);
        st[i].sufx = st[i].sufy = 0;
        maxcnt = max(maxcnt, st[i].cnt);
    }
    sort(st + 1, st + n + 1, cmp);
    cout << maxcnt << endl;
    for (; maxcnt > 0; maxcnt--)
    {
        tmp.clear();
        for (int i = 1; i <= n; i++)
            if (st[i].cnt == maxcnt)
                tmp.push_back(i);
        cout << 2 * tmp.size() << " ";
        for (int i = 0; i < tmp.size(); i++)
        {
            int cur = tmp[i], pre = (i == 0) ? 0 : tmp[i - 1];
            if (pre != 0 && st[pre].sufx != 0 && st[pre].sufy != 0)
            {
                while ((st[cur].prey - st[pre].y) * (st[pre].sufx - st[pre].x) >= (st[cur].prex - st[pre].x) * (st[pre].sufy - st[pre].y))
                {
                    st[cur].prex -= ny;
                    st[cur].prey += nx;
                }
            }
            st[cur].cnt--;
            cout << st[cur].prex << " " << st[cur].prey << " ";
            cout << st[cur].x << " " << st[cur].y << " ";
            st[pre].sufx = st[cur].prex;
            st[pre].sufy = st[cur].prey;
            st[cur].prex -= ny;
            st[cur].prey += nx;
        }
        for (auto i : tmp)
        {
            st[i].cnt--;

            cout << st[i].prex << " " << st[i].prey << " " << st[i].x << " " << st[i].y << " ";
            st[i].prex -= ny;
            st[i].prey += nx;
        }
        cout << endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3612kb

input:

3
1 2 1
2 1 2
3 3 2

output:

2
4 159987 -800004992 2 1 159988 -800004990 3 3 159985 -799994991 2 1 159986 -799994989 3 3 
2 159986 -800004991 1 2 159984 -799994990 1 2 

result:

wrong answer Integer parameter [name=L] equals to 159985, violates the range [2, 10000]