提出 #72731413


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull=unsigned long long;
const int INF = 1e9;
const long long INFLL = (long long)1e18;
const double PI = acos(-1);
//cout << fixed << setprecision(15) << ans << '\n';

int main()
{
  int n,q;cin>>n>>q;
  vector<ld> sita(n),m_sita(n);
  for(int i=0;i<n;i++)
  {
    int x,y;cin>>x>>y;
    ld tmp=atan2(y,x)/PI*180;
    if(tmp<0)tmp=tmp+360;
    sita[i]=tmp;
    m_sita[i]=sita[i];
    //cout<<tmp<<endl;
  }

  sort(sita.begin(),sita.end());

  unordered_map<ld,int> cnt;
  for(int i=0;i<n;i++)
  {
    cnt[sita[i]]++;
  }
  for(int i=0;i<q;i++)
  {
    int a,b;cin>>a>>b;
    ld frm=m_sita[a-1],to=m_sita[b-1];
    int coff=cnt[frm],coft=cnt[to];
    auto f = lower_bound(sita.begin(),sita.end(),frm);
    auto t = lower_bound(sita.begin(),sita.end(),to);
    if(f>t)cout<<f-t+1+coff-1<<endl;
    else if(f==t)cout<<coft<<endl;
    else if(f<t)cout<< coff+f-sita.begin()+sita.end()-t<<endl;
    //cout<< "coff==" << coff<< endl;
    //cout<<"coft==" << coft<<endl;
  }
  return 0;
}

提出情報

提出日時
問題 E - Laser Takahashi
ユーザ maou1
言語 C++23 (GCC 15.2.0)
得点 0
コード長 1123 Byte
結果 WA
実行時間 597 ms
メモリ 28216 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 2 ms 3636 KiB
00_sample_01.txt AC 1 ms 3704 KiB
00_sample_02.txt AC 1 ms 3788 KiB
01_random_00.txt AC 273 ms 9328 KiB
01_random_01.txt AC 423 ms 27544 KiB
01_random_02.txt AC 494 ms 26560 KiB
01_random_03.txt AC 20 ms 4648 KiB
01_random_04.txt AC 459 ms 28188 KiB
01_random_05.txt AC 595 ms 28172 KiB
01_random_06.txt AC 597 ms 28184 KiB
01_random_07.txt AC 594 ms 28080 KiB
01_random_08.txt AC 596 ms 28216 KiB
01_random_09.txt AC 595 ms 28168 KiB
02_random2_00.txt AC 579 ms 24620 KiB
02_random2_01.txt AC 577 ms 24672 KiB
02_random2_02.txt AC 578 ms 24616 KiB
02_random2_03.txt AC 578 ms 24636 KiB
02_random2_04.txt AC 578 ms 24688 KiB
02_random2_05.txt AC 586 ms 27176 KiB
02_random2_06.txt AC 578 ms 24588 KiB
02_random2_07.txt AC 577 ms 24632 KiB
02_random2_08.txt AC 586 ms 27352 KiB
02_random2_09.txt AC 579 ms 24692 KiB
03_random3_00.txt AC 542 ms 23684 KiB
03_random3_01.txt AC 484 ms 20564 KiB
03_random3_02.txt AC 426 ms 16560 KiB
03_random3_03.txt AC 362 ms 13140 KiB
03_random3_04.txt AC 297 ms 9696 KiB
04_handmade_00.txt AC 242 ms 9504 KiB
04_handmade_01.txt AC 247 ms 9700 KiB
04_handmade_02.txt AC 157 ms 3844 KiB
05_killer_00.txt WA 435 ms 11960 KiB
05_killer_01.txt WA 421 ms 10596 KiB