답안 #1101568

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1101568 2024-10-16T10:43:46 Z MMihalev Simurgh (IOI17_simurgh) C++14
0 / 100
1 ms 508 KB
#include<iostream>
#include<algorithm>
#include<set>
#include<queue>
#include "simurgh.h"
using namespace std;
const int MAX_N=5e2+3;
const int MAX_M=125000;
int n,m;
int q;

vector<int>edges;
vector<int>adj;
vector<vector<int> >edgesadj;
vector<int>dfs;
vector<vector<int> >edgesdfs;

vector<pair<int,int> >g[MAX_N];
bool used[MAX_N];
bool marked[MAX_N];

bool stat[MAX_M];
int adje[MAX_N];

bool ok[MAX_N][MAX_N];
vector<int> find_roads(int N, vector<int> u, vector<int> v)
{
    n=N;
    m=u.size();

    vector<int>ans;
    vector<pair<int,int>>so;
    for(int i=0;i<m;i++)
    {
        g[u[i]].push_back({v[i],i});
        g[v[i]].push_back({u[i],i});
        ok[u[i]][v[i]]=i;
        ok[v[i]][u[i]]=i;
    }

    for(int i=0;i<n;i++)
    {
        so.push_back({g[i].size(),i});
    }
    sort(so.rbegin(),so.rend());

    int cnt=0;
    for(auto [sz,u]:so)
    {
        cnt++;
        marked[u]=1;
        for(auto [v,edge]:g[u])used[v]=1;

        bool bad=0;
        for(int i=0;i<n;i++)
        {
            if(marked[i])continue;
            if(used[i])continue;
            bad=1;
            break;
        }
        if(bad==0)
        {
            if(cnt>100)while(1);
            break;
        }
    }



    return ans;
}

Compilation message

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:48:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   48 |     for(auto [sz,u]:so)
      |              ^
simurgh.cpp:52:18: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   52 |         for(auto [v,edge]:g[u])used[v]=1;
      |                  ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 508 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB WA in grader: NO
2 Halted 0 ms 0 KB -