제출 #232679

#제출 시각아이디문제언어결과실행 시간메모리
232679crossing0ver저장 (Saveit) (IOI10_saveit)C++17
0 / 100
247 ms14576 KiB
#include<bits/stdc++.h> #include "grader.h" #include "encoder.h" using namespace std; vector<int> adj[1005]; bool vis[1005]; int dis[1005]; void binary (int n) { for (int i = 0; i < 10; i++) if ((1 << i) & n) encode_bit(1); else encode_bit(0); } bool COOL[1001][1001]; void encode(int nv, int nh, int ne, int *v1, int *v2){ for (int i = 0; i < ne; i++) { adj[v1[i]].push_back(v2[i]); adj[v2[i]].push_back(v1[i]); } for (int s = 0; s < nh; s++) { queue<int> q; q.push(s); vis[s] = 1; while (!q.empty()) { int v = q.front(); q.pop(); for (auto i : adj[v]) { if (!vis[i]) { vis[i] = 1; dis[i] = dis[v] + 1; q.push(i); COOL[i][v] = COOL[v][i] = 1; } } } memset(vis,0,sizeof vis); memset(dis,0,sizeof dis); } int ans = 0; vector<pair<int,int> > v; for (int i = 0; i < nv; i++) for (int j = i; j < nv; j++) if (COOL[i][j]) { ans++; v.push_back({i,j}); } sort(v.begin(),v.end()); int cur = 0; for (auto i : v) { while (cur != i.first) { binary(1023); cur++; } binary(i.second); } binary(1022); }
#include<bits/stdc++.h> #include "grader.h" #include "decoder.h" using namespace std; vector<int> adj[1005]; bool vis[1005]; int dis[1005]; void decode(int nv, int nh) { int cur = 0; while (cur <= nv) { int s = 0; for (int i = 0; i < 10; i++) if (decode_bit()) s |= (1 << i); if (s == 1022) break; if (s == 1023) cur++; adj[cur].push_back(s); adj[s].push_back(cur); } for (int s = 0; s < nh; s++) { hops(s,s,0); queue<int> q; q.push(s); vis[s] = 1; while (!q.empty()) { int v = q.front(); q.pop(); for (auto i : adj[v]) { if (!vis[i]) { hops(s,i,dis[v] + 1); vis[i] = 1; dis[i] = dis[v] + 1; q.push(i); } } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...