Submission #73993

#TimeUsernameProblemLanguageResultExecution timeMemory
73993zubecSaveit (IOI10_saveit)C++14
50 / 100
371 ms14056 KiB
#include "encoder.h" #include "grader.h" #include <vector> #include <queue> #include <iostream> using namespace std; vector <int> g[1100]; int d[1100][1100]; void encode(int nv, int nh, int ne, int *v1, int *v2){ for (int i = 0; i < nv; i++) g[i].clear(); for (int i = 0; i < ne; i++){ int a = v1[i], b = v2[i]; g[a].push_back(b); g[b].push_back(a); } for (int i = 0; i < nh; i++){ for (int j = 0; j < nv; j++) d[i][j] = 1e9; d[i][i] = 0; queue<int> q; q.push(i); while(!q.empty()){ int v = q.front(); q.pop(); for (int j = 0; j < g[v].size(); j++){ int to = g[v][j]; if (d[i][v] + 1 < d[i][to]){ d[i][to] = d[i][v] + 1; q.push(to); } } } } for (int i = 0; i < nh; i++){ for (int j = 0; j < nv; j++){ for (int k = 0; k < 10; k++){ if (d[i][j]&(1<<k)) encode_bit(1); else encode_bit(0); } } } return; }
#include "decoder.h" #include "grader.h" void decode(int nv, int nh) { for (int i = 0; i < nh; i++){ for (int j = 0; j < nv; j++){ int sum = 0; for (int k = 0; k < 10; k++){ sum += decode_bit()*(1<<k); } hops(i, j, sum); } } }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:32:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int j = 0; j < g[v].size(); j++){
                             ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...