답안 #447232

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
447232 2021-07-25T09:22:51 Z Yahli Roads (CEOI20_roads) C++17
0 / 100
129 ms 1840 KB
#include <bits/stdc++.h> 

using namespace std; 

using pi = pair<int, int>; 
using ppi = pair<pi, pi>; 

int counter = 0; 

void process(vector<ppi> line){
    for (int i = 1; i < line.size(); ++i){
        cout << line[i-1].second.first << " " << line[i-1].second.second << " " << line[i].first.first << " " << line[i].first.second << endl; 
        counter++; 
    }
}

bool cmp(ppi f, ppi s){
    if (f.first.second != s.first.second) return f.first.second < s.first.second; 
    return f < s; 
}
int main(){
    int n; cin >> n; 
    vector<ppi> data(n); 

    for (int i = 0; i < n; ++i){
        cin >> data[i].first.first >> data[i].first.second >> data[i].second.first >> data[i].second.second; 
        if (data[i].first.first > data[i].second.first) swap(data[i].first, data[i].second);
    }

    sort(data.begin(), data.end(), cmp); 

    vector<ppi> line; 
    for (ppi now : data){
        if (line.size() == 0 || line[0].first.second == now.first.second) line.push_back(now); 
        else if (line.size() != 0){
            cout << line[0].first.first << " " << line[0].first.second << " " << now.first.first << " " << now.first.second << endl; 
            counter++; 
            process(line); 
            line = vector<ppi>(1, now); 
        }
        else line.push_back(now); 
    }
    process(line); 

    if (counter != n-1) return -1; 
}

Compilation message

roads.cpp: In function 'void process(std::vector<std::pair<std::pair<int, int>, std::pair<int, int> > >)':
roads.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, int>, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 1; i < line.size(); ++i){
      |                     ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Failed 129 ms 1732 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Failed 1 ms 204 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Failed 1 ms 204 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Failed 1 ms 204 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Failed 1 ms 204 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Failed 126 ms 1840 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
3 Halted 0 ms 0 KB -