暴力if判断,乱输出 求调 玄关
  • 板块P1105 平台
  • 楼主Sirius6699
  • 当前回复4
  • 已保存回复4
  • 发布时间2024/7/15 19:44
  • 上次更新2024/7/15 20:29:18
查看原帖
暴力if判断,乱输出 求调 玄关
1041365
Sirius6699楼主2024/7/15 19:44

思路图:


// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <queue>
#include <vector>
#define coutdouble(a, b) cout << fixed << setprecision(a) << (b)
#define ll long long
#define endl '\n'

using namespace std;

const int N = 1e4 + 5;
const int INF = 0x3f3f3f;
const int INFS = -0x3f3f3f;

int n;

struct platform
{
    int no, h, l, r;
} a[N];

void solve()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i].h >> a[i].l >> a[i].r;
        a[i].no = i;
    }

    for (int i = 1; i <= n; i++)
    {
        if (a[i].h == 1) cout << "0 0" << endl;
        else
        {
            for (int l = 1; l <= n; l++)
            {
                if (a[i].h == a[l].h) cout << 0 << " ";
                else if (a[i].l == a[l].r) cout << a[l].no << " ";
                else if (a[i].r > a[l].r && a[i].l < a[l].r && a[l].l < a[i].l) cout << a[l].no << " ";
                else if (a[i].r == a[l].r && a[l].l < a[i].l) cout << a[l].no << " ";
                else cout << 0 << " ";
            }
            for (int r = 1; r <= n; r++)
            {
                if (a[i].h == a[r].h) cout << 0 << endl;
                if (a[i].l == a[r].r) cout << a[r].no << endl;
                else if (a[i].l < a[r].l && a[i].r > a[r].l && a[r].r > a[i].r) cout << a[r].no << endl;
                else if (a[i].l == a[r].l && a[r].r > a[i].r) cout << a[r].no << endl;
                else cout << 0 << endl;
            }
        }
    }
}

signed main()
{
    // freopen("../in_out/in.txt", "r", stdin);
    // freopen("../in_out/out.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);  // 关闭同步流

    int t = 1;
    // cin>>t;
    while (t--)
    {
        solve();
    }

    return 0;
}

2024/7/15 19:44
加载中...