Submission #1036404

#TimeUsernameProblemLanguageResultExecution timeMemory
1036404beaconmc전선 연결 (IOI17_wiring)C++14
Compilation error
0 ms0 KiB
#include "wiring.h" #include <bits/stdc++.h> typedef long long ll; #define FOR(i,x,y) for(ll i=x; i<y; i++) #define FORNEG(i,x,y) for(ll i=x; i>y; i--) using namespace std; ll n,m; vector<ll> R,B; unordered_map<int,ll> cache; unordered_map<int,ll> poses; bool flag = true ll dp(ll x, ll y){ if (flag && abs(poses[R[x]]-poses[B[y]]) > 20) return 1000000000000000; if (cache.count(x*1000000+y)) return cache[x*1000000+y]; if (x==n && y==m) return 0; if (x>=n || y >= m) return 1000000000000000; return cache[x*1000000+y] = min(dp(x+1,y), min(dp(x,y+1), dp(x+1,y+1))) + abs(R[x] - B[y]); } long long min_total_length(std::vector<int> r, std::vector<int> b) { flag = true; R.clear(); B.clear(); vector<ll> stuff; for (auto&i : r) stuff.push_back(i); for (auto&i : b) stuff.push_back(i); if (r.size() > 200 || b.size() > 200) flag = false; sort(stuff.begin(), stuff.end()); FOR(i,0,stuff.size()){ poses[stuff[i]] = i; } cache.clear(); for (auto&i : r) R.push_back(i); for (auto&i : b) B.push_back(i); n = r.size(); m = b.size(); return dp(0,0); }

Compilation message (stderr)

wiring.cpp:17:1: error: expected ',' or ';' before 'll'
   17 | ll dp(ll x, ll y){
      | ^~
wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:5:33: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define FOR(i,x,y) for(ll i=x; i<y; i++)
......
   37 |  FOR(i,0,stuff.size()){
      |      ~~~~~~~~~~~~~~~~            
wiring.cpp:37:2: note: in expansion of macro 'FOR'
   37 |  FOR(i,0,stuff.size()){
      |  ^~~
wiring.cpp:46:9: error: 'dp' was not declared in this scope
   46 |  return dp(0,0);
      |         ^~