Submission #369319

#TimeUsernameProblemLanguageResultExecution timeMemory
369319Sparky_09Mobitel (COCI19_mobitel)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define trav(a, x) for(auto& a : x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<ll, ll> pii; typedef vector<ll> vi; typedef vector<pii> vpi; int rd() { int result = 0; char ch; ch = getchar(); while(ch < '0' || ch > '9') ch = getchar(); result = ch-'0'; while (true) { ch = getchar(); if (ch < '0' || ch > '9') break; result = result*10 + (ch - '0'); } return result; } template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; } template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; } void usaco(string s){ freopen((s+".in").c_str(), "r", stdin); freopen((s+".out").c_str(), "w", stdout); } const int N = 300 + 3; const int K = 3010; int n, m, v, dp[2][N][K], a[N][N]; int cnt; map<int, int> val, id; inline int q(int a, int b){ return int(ceil(1.0 * a / b)); } int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); #ifdef LOCAL_DEFINE freopen("input.txt", "r", stdin); #endif n = rd(); m = rd(); v = rd(); init(); for(int i = 1; i <= n; i++) for(int j = 1; j <= m; j++) a[i][j] = rd(); dp[0][1][id[v]] = 1; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++) for(int k = 0; k < cnt; k++) dp[i & 1][j][k] = 0; for(int j = 1; j <= m; j++) for(int k = 0; k < cnt; k++){ int from = id[q(val[k], a[i][j])]; add(dp[i & 1][j][from], dp[(i - 1) & 1][j][k]); if(j > 1) add(dp[i & 1][j][from], dp[i & 1][j - 1][k]); } } int r = dp[n & 1][m][id[1]]; cout << r << endl; }

Compilation message (stderr)

mobitel.cpp: In function 'int main()':
mobitel.cpp:52:5: error: 'init' was not declared in this scope; did you mean 'int'?
   52 |     init();
      |     ^~~~
      |     int
mobitel.cpp:68:17: error: 'add' was not declared in this scope; did you mean 'std::filesystem::perm_options::add'?
   68 |                 add(dp[i & 1][j][from], dp[(i - 1) & 1][j][k]);
      |                 ^~~
      |                 std::filesystem::perm_options::add
In file included from /usr/include/c++/9/filesystem:36,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:129,
                 from mobitel.cpp:1:
/usr/include/c++/9/bits/fs_fwd.h:201:7: note: 'std::filesystem::perm_options::add' declared here
  201 |       add = 0x2,
      |       ^~~
mobitel.cpp: In function 'void usaco(std::string)':
mobitel.cpp:30:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   30 |   freopen((s+".in").c_str(), "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mobitel.cpp:31:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   31 |   freopen((s+".out").c_str(), "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~