Submission #684425

#TimeUsernameProblemLanguageResultExecution timeMemory
684425horiseunAirline Route Map (JOI18_airline)C++11
0 / 100
478 ms19580 KiB
#include "Alicelib.h" #include <iostream> #include <vector> #include <set> #include <tuple> #include <cassert> #include <algorithm> using namespace std; #define f first #define s second void Alice(int N, int M, int A[], int B[]) { vector<int> deg(1e6, 0); vector<pair<int, int>> edges; for (int i = 0; i < M; i++) { edges.push_back({A[i], B[i]}); deg[A[i]]++; deg[B[i]]++; } int mx = 0; for (int i = N - 1; i >= 0; i--) { mx = max(mx, deg[i] + i + 1); } int nd = N; for (int i = 0; i < N; i++) { while (deg[i] < mx) { edges.push_back({i, nd++}); deg[i]++; deg[nd]++; } mx--; } InitG(nd, edges.size()); for (int i = 0; i < edges.size(); i++) { MakeG(i, edges[i].f, edges[i].s); } return; }
#include "Boblib.h" #include <iostream> #include <vector> #include <set> #include <tuple> #include <cassert> #include <algorithm> using namespace std; #define f first #define s second void Bob(int V, int U, int C[], int D[]) { vector<int> deg(V, 0); for (int i = 0; i < U; i++) { deg[C[i]]++; deg[D[i]]++; } vector<pair<int, int>> nds; for (int i = 0; i < V; i++) { nds.push_back({deg[i], i}); } sort(nds.begin(), nds.end(), greater<pair<int, int>>()); vector<int> mp(V, 0); for (int i = 0; i < V; i++) { mp[nds[i].s] = i; } vector<pair<int, int>> edges; set<int> s; for (int i = 0; i < U; i++) { if (deg[C[i]] == 1 && deg[D[i]] == 1) continue; edges.push_back({mp[C[i]], mp[D[i]]}); } for (int i = 0; i < V; i++) { if (deg[i] != 1) { s.insert(mp[i]); } } InitMap(s.size(), edges.size()); for (int i = 0; i < edges.size(); i++) { MakeMap(edges[i].f, edges[i].s); } return; }

Compilation message (stderr)

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:35:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for (int i = 0; i < edges.size(); i++) {
      |                     ~~^~~~~~~~~~~~~~

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:40:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for (int i = 0; i < edges.size(); i++) {
      |                     ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...