제출 #1005496

#제출 시각아이디문제언어결과실행 시간메모리
1005496vjudge1무제 (POI11_imp)C++17
45 / 100
1115 ms65536 KiB
//
//  main.cpp
//  IntensiveCamp 2 2024
//
//  Created by Ali AlSalman on 17/05/2024.
//
 
#include <bits/stdc++.h>
 
#define endl '\n'
 
using namespace std;

set<pair<int, int>> edges;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    
    
    int n, m;
    cin>>n>>m;
    set<int> nodes; for (int i = 1; i <= n; i++) nodes.insert(i);
    while (m--) {
        int a, b;
        cin>>a>>b;
        edges.insert({min(a, b), max(a, b)});
    }
    
    for (int i = 1; i <= n; i++) for (int j = i + 1; j <= n; j++) {
        if (nodes.find(i) != nodes.end() && nodes.find(j) != nodes.end() &&
            edges.find({i, j}) == edges.end()) { nodes.erase(i); nodes.erase(j); }
    }
    
    int reqRes = n / 3;
    for (auto node = nodes.begin(); reqRes--; node++) cout<<*node<<" "; cout<<endl;
}

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

imp.cpp: In function 'int main()':
imp.cpp:35:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   35 |     for (auto node = nodes.begin(); reqRes--; node++) cout<<*node<<" "; cout<<endl;
      |     ^~~
imp.cpp:35:73: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   35 |     for (auto node = nodes.begin(); reqRes--; node++) cout<<*node<<" "; cout<<endl;
      |                                                                         ^~~~
#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...
#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...