Submission #133461

#TimeUsernameProblemLanguageResultExecution timeMemory
133461dualityAirline Route Map (JOI18_airline)C++11
0 / 100
1016 ms31208 KiB
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back typedef long long int LLI; typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pii> vpii; #include "Alicelib.h" static vpii edges; void Alice(int N,int M,int *A,int *B) { int i,j; for (i = 0; i < M; i++) edges.pb(mp(A[i],B[i])); for (i = 0; i < N; i++) edges.pb(mp(N,i)); for (i = 0; i < 10; i++) edges.pb(mp(N+i+1,N+11)); for (i = 1; i < 10; i++) edges.pb(mp(N+i,N+i+1)); edges.pb(mp(N+2,N+4)); for (i = 0; i < N; i++) { for (j = 0; j < 10; j++) { if ((i+7) & (1 << j)) edges.pb(mp(i,N+j+1)); } } InitG(N+12,edges.size()); for (i = 0; i < edges.size(); i++) MakeG(i,edges[i].first,edges[i].second); }
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back typedef long long int LLI; typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pii> vpii; #include "Boblib.h" static vpii edges; bitset<1012> adjMat[1012]; vi adjList[1012]; int c[1012],num[1012]; void Bob(int V,int U,int *C,int *D) { int i,j; int x,y; int N = V-12; for (i = 0; i < U; i++) adjMat[C[i]][D[i]] = adjMat[D[i]][C[i]] = 1; for (i = 0; i < V; i++) c[i] = adjMat[i].count(); for (i = 0; i < V; i++) { for (j = 0; j < V; j++) { if ((c[i] == N) && (c[j] == 10)) { bitset<1012> bs = adjMat[i] | adjMat[j]; bs[i] = bs[j] = 1; if (bs.count() == V) { x = i,y = j; break; } } } if (j < V) break; } vi v,v2; for (i = 0; i < V; i++) { if (adjMat[y][i]) v.pb(i); } for (i = 0; i < v.size(); i++) { for (j = 0; j < v.size(); j++) { if (adjMat[v[i]][v[j]]) adjList[v[i]].pb(v[j]); } } for (i = 0; i < v.size(); i++) { if ((adjList[v[i]].size() == 1) && (adjList[adjList[v[i]][0]].size() == 3)) break; } int u = v[i]; fill(num,num+V,-1); num[u] = 0; for (i = 1; i < 10; i++) { if (i == 1) u = adjList[u][0]; else if (i == 2) { if (adjList[adjList[u][0]].size() == 2) u = adjList[u][0]; else if (adjList[adjList[u][1]].size() == 2) u = adjList[u][1]; else u = adjList[u][2]; } else { for (j = 0; j < adjList[u].size(); j++) { if (num[adjList[u][j]] == -1) { u = adjList[u][j]; break; } } } num[u] = i; } for (i = 0; i < V; i++) { if (adjMat[x][i]) v2.pb(i); } for (i = 0; i < v2.size(); i++) { int n = 0; for (j = 0; j < v.size(); j++) { if (adjMat[v2[i]][v[j]]) n |= (1 << num[v[j]]); } num[v2[i]] = n-7; } for (i = 0; i < v2.size(); i++) { for (j = i+1; j < v2.size(); j++) { if (adjMat[v2[i]][v2[j]]) edges.pb(mp(num[v2[i]],num[v2[j]])); } } InitMap(N,edges.size()); for (i = 0; i < edges.size(); i++) MakeMap(edges[i].first,edges[i].second); }

Compilation message (stderr)

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:25:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < edges.size(); i++) MakeG(i,edges[i].first,edges[i].second);
                 ~~^~~~~~~~~~~~~~

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:26:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 if (bs.count() == V) {
                     ~~~~~~~~~~~^~~~
Bob.cpp:38:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < v.size(); i++) {
                 ~~^~~~~~~~~~
Bob.cpp:39:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (j = 0; j < v.size(); j++) {
                     ~~^~~~~~~~~~
Bob.cpp:43:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < v.size(); i++) {
                 ~~^~~~~~~~~~
Bob.cpp:57:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (j = 0; j < adjList[u].size(); j++) {
                         ~~^~~~~~~~~~~~~~~~~~~
Bob.cpp:69:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < v2.size(); i++) {
                 ~~^~~~~~~~~~~
Bob.cpp:71:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (j = 0; j < v.size(); j++) {
                     ~~^~~~~~~~~~
Bob.cpp:76:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < v2.size(); i++) {
                 ~~^~~~~~~~~~~
Bob.cpp:77:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (j = i+1; j < v2.size(); j++) {
                       ~~^~~~~~~~~~~
Bob.cpp:82:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < edges.size(); i++) MakeMap(edges[i].first,edges[i].second);
                 ~~^~~~~~~~~~~~~~
Bob.cpp:17:9: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int x,y;
         ^
Bob.cpp:17:11: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int x,y;
           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...