답안 #447229

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
447229 2021-07-25T09:11:55 Z Yahli Roads (CEOI20_roads) C++14
0 / 100
76 ms 1800 KB
#include <bits/stdc++.h> 

using namespace std; 

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

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 << "\n"; 
    }
}

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 << "\n"; 
            process(line); 
            line = vector<ppi>(1, now); 
        }
        else line.push_back(now); 
    }
    process(line); 
}

Compilation message

roads.cpp: In function 'void process(std::vector<std::pair<std::pair<int, int>, std::pair<int, int> > >)':
roads.cpp:9: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]
    9 |     for (int i = 1; i < line.size(); ++i){
      |                     ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Failed 76 ms 1736 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
# 결과 실행 시간 메모리 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 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 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 Correct 1 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 73 ms 1800 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
3 Halted 0 ms 0 KB -