제출 #1029846

#제출 시각아이디문제언어결과실행 시간메모리
1029846Tob저장 (Saveit) (IOI10_saveit)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "grader.h" #include "encoder.h" #define F first #define S second #define all(x) x.begin(), x.end() #define pb push_back #define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) using namespace std; typedef long long ll; typedef pair <ll, ll> pii; const int N = 1e3 + 7; vector <int> no, ba; vector <int> adj[N]; int dis[36][N], bio[N]; void dfs(int x) { bio[x] = 1; no.pb(x); for (int y : adj[x]) if (!bio[y]) { dfs(y); no.pb(-1); } } void encode(int n, int h, int m, int *u, int *v){ for (int i = 0; i < m; i++) { adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } memset(dis, -1, sizeof dis); for (int i = 0; i < h; i++) { queue <int> q; q.push(i); dis[i][i] = 0; while (!q.empty()) { int x = q.front(); q.pop(); for (int y : adj[x]) if (dis[i][y] == -1) { dis[i][y] = dis[i][x] + 1; q.push(y); } } } dfs(0); vector <int> en, cur; cur.pb(0); for (int i = 1; i < 2*n-1; i++) { if (no[i] == -1) { en.pb(1); cur.pop_back(); } else { en.pb(0); int x = cur.back(); cur.pb(no[i]); for (int j = 0; j < 10; j++) en.pb((no[i] >> j) & 1); ll la = 0; for (int j = 0; j < h; j++) la = 3*la+1+dis[j][no[i]]-dis[j][x]; for (int j = 0; j < 58; j++) en.pb((la >> j) & 1); } } for (int x : en) encode_bit(x); }
#include <bits/stdc++.h> #include "grader.h" #include "decoder.h" #define F first #define S second #define all(x) x.begin(), x.end() #define pb push_back #define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) using namespace std; typedef long long ll; typedef pair <ll, ll> pii; int res[36][N]; void decode(int n, int h) { vector <int> cd(h, 0); vector <vector <int> > ch; for (int i = 0; i < 2*n-2; i++) { int o = decode_bit(); if (o) { for (int j = 0; j < h; j++) cd[j] -= ch[ch.size()-1][j]; ch.pop_back(); } else { int x = 0; for (int j = 0; j < 10; j++) x += decode_bit() << j; ll d = 0; for (int j = 0; j < 58; j++) d += (ll)decode_bit() << j; vector <int> tmp(h); for (int j = h-1; j >= 0; j--) { tmp[j] = d%3-1; cd[j] += tmp[j]; d /= 3; } ch.pb(tmp); for (int j = 0; j < h; j++) res[j][x] = cd[j]; } } vector <int> ud(h); for (int i = 0; i < h; i++) ud[i] = res[i][i]; for (int i = 0; i < h; i++) { for (int j = 0; j < n; j++) { hops(i, j, res[i][j]-ud[i]); } } }

컴파일 시 표준 에러 (stderr) 메시지

decoder.cpp:15:13: error: 'N' was not declared in this scope
   15 | int res[36][N];
      |             ^
decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:38:32: error: 'res' was not declared in this scope
   38 |    for (int j = 0; j < h; j++) res[j][x] = cd[j];
      |                                ^~~
decoder.cpp:42:38: error: 'res' was not declared in this scope
   42 |  for (int i = 0; i < h; i++) ud[i] = res[i][i];
      |                                      ^~~
decoder.cpp:45:15: error: 'res' was not declared in this scope
   45 |    hops(i, j, res[i][j]-ud[i]);
      |               ^~~