Submission #564993

#TimeUsernameProblemLanguageResultExecution timeMemory
564993birthdaycakeSaveit (IOI10_saveit)C++14
Compilation error
0 ms0 KiB
int dis[1001][37]; vector<int>adj[1001]; void reset(int n, int h){ for(int i = 0; i < n; i++){ adj[i].clear(); for(int j = 0; j < h; j++) dis[i][j] = 1e18; } } int encode_bit(int x){ return x; } void encode(int n, int h, int p, int a[], int b[]){ reset(n,h); for(int i = 0; i < p; i++){ adj[a[i]].push_back(b[i]); adj[b[i]].push_back(a[i]); } for(int i = 0; i < h; i++){ dis[i][i] = 0; set<pair<int,int>>bfs; bfs.insert({0,i}); while(bfs.size()){ auto x = *bfs.begin(); bfs.erase(x); if(dis[x.second][i] < x.first) continue; for(auto s:adj[x.second]){ if(dis[x.second] + 1 < dis[s]){ dis[s] = dis[x.second] + 1; bfs.insert({dis[x.second] + 1, s}); } } } } for(int i = 0; i < n; i++){ for(int j = 0; j < h; j++){ for(int k = 0; k < 10; k++){ if(dis[i][j] & (1 << k)) encode_bit(1); else encode_bit(0); } } } }
int dis[1001][37]; void reset(int n, int h){ for(int i = 0; i < n; i++){ for(int j = 0; j < h; j++) dis[i][j] = 0; } } int decode(int n, int h){ reset(n,h); for(int i = 0; i < n; i++){ for(int j = 0; j < j; j++){ for(int k = 0; k < 10; k++){ dis[i][j] += (1 << decode_bit()); } } } for(int i = 0; i < n; i++){ for(int j = 0; j < h; j++){ hops(j,i,dis[i][j]); } } }

Compilation message (stderr)

encoder.cpp:2:1: error: 'vector' does not name a type
    2 | vector<int>adj[1001];
      | ^~~~~~
encoder.cpp: In function 'void reset(int, int)':
encoder.cpp:9:9: error: 'adj' was not declared in this scope
    9 |         adj[i].clear();
      |         ^~~
encoder.cpp:10:48: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   10 |         for(int j = 0; j < h; j++) dis[i][j] = 1e18;
      |                                                ^~~~
encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:27:9: error: 'adj' was not declared in this scope
   27 |         adj[a[i]].push_back(b[i]);
      |         ^~~
encoder.cpp:33:9: error: 'set' was not declared in this scope; did you mean 'reset'?
   33 |         set<pair<int,int>>bfs;
      |         ^~~
      |         reset
encoder.cpp:33:13: error: 'pair' was not declared in this scope
   33 |         set<pair<int,int>>bfs;
      |             ^~~~
encoder.cpp:33:18: error: expected primary-expression before 'int'
   33 |         set<pair<int,int>>bfs;
      |                  ^~~
encoder.cpp:34:9: error: 'bfs' was not declared in this scope
   34 |         bfs.insert({0,i});
      |         ^~~
encoder.cpp:39:24: error: 'adj' was not declared in this scope
   39 |             for(auto s:adj[x.second]){
      |                        ^~~

decoder.cpp: In function 'int decode(int, int)':
decoder.cpp:16:26: warning: self-comparison always evaluates to false [-Wtautological-compare]
   16 |         for(int j = 0; j < j; j++){
      |                        ~ ^ ~
decoder.cpp:18:36: error: 'decode_bit' was not declared in this scope; did you mean 'decode'?
   18 |                 dis[i][j] += (1 << decode_bit());
      |                                    ^~~~~~~~~~
      |                                    decode
decoder.cpp:25:13: error: 'hops' was not declared in this scope
   25 |             hops(j,i,dis[i][j]);
      |             ^~~~
decoder.cpp:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
   28 | }
      | ^