답안 #1101553

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1101553 2024-10-16T10:01:35 Z Raj Circle Passing (EGOI24_circlepassing) C++11
0 / 100
41 ms 336 KB
#include <bits/stdc++.h>
using namespace std;
int n,M,Q;
set <int> s;
int stanga(int x,int y)
{
    if(x<y)
        return 2*n-y+x;
    else
        return x-y;
}
int dreapta(int x,int y)
{
    if(x>y)
        return 2*n-x+y;
    else
        return y-x;
}
int shc(int x, int y)
{
    auto vst=distance(s.begin(), s.lower_bound(x));
    int vdr=distance(s.begin(), s.upper_bound(x));
    cout<<'\n';
    cout<<vst<<' '<<vdr<<'\n';
    return 0;
    if(vst==0)
        vst=*s.end();
    if(vdr==s.size())
        vdr=*s.begin();
    cout<<vst<<' '<<vdr<<'\n';
    return 0;
    int dist1=stanga(x,vst)+stanga(vst,y);
    int dist2=stanga(x,vst)+dreapta(vst,y);
    int dist3=dreapta(x,vdr)+stanga(vdr,y);
    int dist4=dreapta(x,vdr)+dreapta(vdr,y);
    return min(dist1,min(dist2,min(dist3,dist4)));
}
int main()
{
    cin>>n>>M>>Q;
    for(int i=1;i<=M;++i)
    {
        int x;
        cin>>x;
        s.insert(abs(2*n-x));
        s.insert(abs(x));
    }
    for(int i=1;i<=Q;++i)
    {
        int a,b;
        cin>>a>>b;
        cout<<shc(a,b);

    cout<<'\n';
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int shc(int, int)':
Main.cpp:28:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     if(vdr==s.size())
      |        ~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 41 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -