답안 #917536

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
917536 2024-01-28T11:44:47 Z alexdd 항공 노선도 (JOI18_airline) C++17
0 / 100
2500 ms 164336 KB
#include "Alicelib.h"
#include<bits/stdc++.h>
using namespace std;
void Alice(int N, int M, int A[], int B[])
{
    vector<pair<int,int>> edges;
    for(int i=0;i<M;i++)
        edges.push_back({A[i],B[i]});
    for(int i=0;i<N;i++)
    {
        for(int b=0;b<10;b++)
        {
            if((i&(1<<b)))
            {
                edges.push_back({i,N+b});
            }
        }
    }
    for(int i=0;i<N+10;i++)
        edges.push_back({N+10,i});
    for(int i=0;i<10;i++)
        edges.push_back({N+11,N+i});
    InitG(N+12, edges.size());
    for(int i=0;i<edges.size();i++)
        MakeG(i,edges[i].first,edges[i].second);
}

#include "Boblib.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> con[1100];
map<pair<int,int>,int> mp;
map<pair<int,int>,int> init;
int p,q;
int sum[1100];
void Bob(int V, int U, int C[], int D[])
{
    for(int i=0;i<U;i++)
    {
        con[C[i]].push_back(D[i]);
        con[D[i]].push_back(C[i]);
        mp[{C[i],D[i]}]++;
        mp[{D[i],C[i]}]++;
    }
    for(int i=0;i<V;i++)
    {
        if((int)con[i].size() == V-2)
        {
            p=i;
            for(int j=0;j<V;j++)
                if(j!=i && mp[{i,j}]==0)
                    q=j;
            break;
        }
    }
    vector<pair<int,int>> b;
    for(auto x:con[q])
        b.push_back({-(int)con[x].size(),x});
    sort(b.begin(),b.end());
    for(int i=0;i<10;i++)
        for(auto x:con[b[i].second])
            sum[x] += (1<<i);
    vector<pair<int,int>> rez;
    for(int i=0;i<V;i++)
    {
        if(i!=p && i!=q && !mp[{q,i}])
        {
            //cout<<i<<" "<<sum[i]<<" sum\n";
            for(auto x:con[i])
            {
                if(x!=p && x!=q && !mp[{q,x}] && init[{sum[x],sum[i]}]==0)
                {
                    init[{sum[i],sum[x]}]++;
                    rez.push_back({sum[i],sum[x]});
                }
            }
        }
    }
    InitMap(V-12,rez.size());
    for(auto e:rez)
        MakeMap(e.first,e.second);

}

Compilation message

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:24:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i=0;i<edges.size();i++)
      |                 ~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 15616 KB Output is correct
2 Correct 3 ms 15620 KB Output is correct
3 Correct 3 ms 15620 KB Output is correct
4 Correct 3 ms 13572 KB Output is correct
5 Failed 3 ms 15620 KB Wrong Answer [13]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 15616 KB Output is correct
2 Correct 3 ms 15620 KB Output is correct
3 Correct 3 ms 15620 KB Output is correct
4 Correct 3 ms 13572 KB Output is correct
5 Failed 3 ms 15620 KB Wrong Answer [13]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2735 ms 164336 KB Time limit exceeded
2 Halted 0 ms 0 KB -