提出 #72726790


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

using LL = long long;

#define int long long

const int N = 2e5 + 1;
const int M = 998244353;
const double PI = acos(-1.0);
void solve()
{
    int n, q;
    cin >> n >> q;
    vector<array<int, 3>> a(n + 1);
    vector<double> ang(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i][0] >> a[i][1];
        a[i][2] = i;
        ang[i] = atan2(a[i][1], a[i][0]);
    }
    vector<double> sangl;
    sangl = ang;
    sort(sangl.begin() + 1, sangl.end());
    int size = sangl.size();
    for (int i = 1; i < size; i++)
    {
        sangl.push_back(sangl[i] + 2 * PI);
    }

    vector<int> pre(n + 1);

    while (q--)
    {
        int x, y;
        cin >> x >> y;
        double stat = ang[x];
        double ed = ang[y];
        if (stat < ed)
            stat += 2 * PI;
        auto l = lower_bound(sangl.begin() + 1, sangl.end(), ed) - sangl.begin();
        auto r = upper_bound(sangl.begin() + 1, sangl.end(), stat) - sangl.begin();
        cout << r - l << "\n";
    }
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    //   cin >> T;

    while (T--)
        solve();

    return 0;
}

提出情報

提出日時
問題 E - Laser Takahashi
ユーザ Hirasawaa
言語 C++23 (GCC 15.2.0)
得点 0
コード長 1257 Byte
結果 WA
実行時間 118 ms
メモリ 13060 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 450
結果
AC × 3
AC × 31
WA × 2
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 02_random2_07.txt, 02_random2_08.txt, 02_random2_09.txt, 03_random3_00.txt, 03_random3_01.txt, 03_random3_02.txt, 03_random3_03.txt, 03_random3_04.txt, 04_handmade_00.txt, 04_handmade_01.txt, 04_handmade_02.txt, 05_killer_00.txt, 05_killer_01.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3736 KiB
00_sample_01.txt AC 1 ms 3696 KiB
00_sample_02.txt AC 1 ms 3696 KiB
01_random_00.txt AC 56 ms 5784 KiB
01_random_01.txt AC 81 ms 12820 KiB
01_random_02.txt AC 94 ms 11780 KiB
01_random_03.txt AC 5 ms 4064 KiB
01_random_04.txt AC 87 ms 12932 KiB
01_random_05.txt AC 117 ms 13060 KiB
01_random_06.txt AC 116 ms 12900 KiB
01_random_07.txt AC 117 ms 12896 KiB
01_random_08.txt AC 116 ms 13060 KiB
01_random_09.txt AC 117 ms 12892 KiB
02_random2_00.txt AC 117 ms 12992 KiB
02_random2_01.txt AC 116 ms 12956 KiB
02_random2_02.txt AC 116 ms 13060 KiB
02_random2_03.txt AC 117 ms 13024 KiB
02_random2_04.txt AC 117 ms 12904 KiB
02_random2_05.txt AC 118 ms 13056 KiB
02_random2_06.txt AC 117 ms 13024 KiB
02_random2_07.txt AC 117 ms 12964 KiB
02_random2_08.txt AC 117 ms 12956 KiB
02_random2_09.txt AC 116 ms 12964 KiB
03_random3_00.txt AC 107 ms 12964 KiB
03_random3_01.txt AC 94 ms 12964 KiB
03_random3_02.txt AC 80 ms 12896 KiB
03_random3_03.txt AC 68 ms 12960 KiB
03_random3_04.txt AC 55 ms 12680 KiB
04_handmade_00.txt AC 40 ms 12824 KiB
04_handmade_01.txt AC 40 ms 12836 KiB
04_handmade_02.txt AC 24 ms 3808 KiB
05_killer_00.txt WA 104 ms 12876 KiB
05_killer_01.txt WA 99 ms 13008 KiB