제출 #534866

#제출 시각아이디문제언어결과실행 시간메모리
534866leinad2Roads (CEOI20_roads)C++17
30 / 100
85 ms12520 KiB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n, i, j, k, a, b, c, d, ca, db, A[100010], B[100010], C[100010], D[100010];
vector<pair<int, int> >v, ans;
main()
{
    for(scanf("%lld", &n);i++<n;)
    {
        scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
        A[i]=a;
        B[i]=b;
        C[i]=c;
        D[i]=d;
        if(i==1)
        {
            ca=c-a;
            db=d-b;
        }
        v.push_back({ca*b-db*a, i});
    }
    sort(v.begin(), v.end());
    for(i=1;i<v.size();i++)
    {
        if(v[i].first!=v[i-1].first)
        {
            a=i-1;
            ans.push_back({v[a].second, v[i].second});
        }
        else
        {
            ans.push_back({v[a].second, v[i].second});
        }
    }
    for(auto p:ans)printf("%lld %lld %lld %lld\n", A[p.first], B[p.first], A[p.second], B[p.second]);
}

컴파일 시 표준 에러 (stderr) 메시지

roads.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~
roads.cpp: In function 'int main()':
roads.cpp:23:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(i=1;i<v.size();i++)
      |             ~^~~~~~~~~
roads.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     for(scanf("%lld", &n);i++<n;)
      |         ~~~~~^~~~~~~~~~~~
roads.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...