제출 #50717

#제출 시각아이디문제언어결과실행 시간메모리
50717Mamnoon_SiamDetecting Molecules (IOI16_molecules)C++17
컴파일 에러
0 ms0 KiB
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
 
#define debug(s) cout<< #s <<" = "<< s <<endl
#define all(v) (v).begin(), (v).end()
#define KeepUnique(v) (v).erase( unique(all(v)), v.end() )
#define MEMSET(a,val) memset(a, val, sizeof a)
#define PB push_back
#define endl '\n'
 
inline int myrand(int l, int r) {
	int ret = rand(); ret <<= 15; ret ^= rand();
	if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
	return ret;
}
template <typename F, typename S>
ostream& operator << (ostream& os, const pair< F, S>& p) {
    return os<<"(" <<p.first<<", "<<p.second<<")"; }
 
typedef pair<int, int> ii;
template<typename T> using min_pq =
	priority_queue<T, vector<T>, greater<T> >;
 
//int dx[] = {-1, +0, +1, +0};
//int dy[] = {+0, +1, +0, -1};
 
const int maxn = 10005;
 
//bitset<maxn> dp[maxn], vis[maxn];
vector<bool> dp, vis;
int a[maxn], l, n, u;
 
int get(int i, int v) {
	if(l <= v and v <= u) return 1;
	if(v > u or i == n) return 0;
	if(vis[i][v]) return dp[i][v];
	vis[i][v] = 1;
	dp[i][v] = get(i + 1, v) | get(i + 1, v + a[i]);
	return dp[i][v];
}
 
void fill(int i, int v, vector<int> &ret) {
	if(l <= v and v <= u) {
		return;
	}
	assert(i < n);
	if(get(i + 1, v)) {
		fill(i + 1, v, ret);
	} else {
		ret.push_back(i);
		fill(i + 1, v + a[i], ret);
	}
}
 
vector<int> find_subset(int L, int U, vector<int> w) {
	dp.assing(maxn, vector<bool>(maxn));
	vis.assing(maxn, vector<bool>(maxn));
    n = w.size(), l = L, u = U;
    for(int i=0; i<n; i++)
    	a[i] = w[i];
    if(get(0, 0)) {
    	vector<int> ret;
    	fill(0, 0, ret);
    	return ret;
    }
    else {
    	return vector<int>();
    }
}

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

molecules.cpp: In function 'int myrand(int, int)':
molecules.cpp:17:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
  if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
  ^~
molecules.cpp:17:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  if(ret < 0) ret = -ret; ret %= (r-l+1); ret += l;
                          ^~~
molecules.cpp: In function 'int get(int, int)':
molecules.cpp:40:11: error: no match for 'operator[]' (operand types are 'std::vector<bool>::reference {aka std::_Bit_reference}' and 'int')
  if(vis[i][v]) return dp[i][v];
           ^
molecules.cpp:40:28: error: no match for 'operator[]' (operand types are 'std::vector<bool>::reference {aka std::_Bit_reference}' and 'int')
  if(vis[i][v]) return dp[i][v];
                            ^
molecules.cpp:41:8: error: no match for 'operator[]' (operand types are 'std::vector<bool>::reference {aka std::_Bit_reference}' and 'int')
  vis[i][v] = 1;
        ^
molecules.cpp:42:7: error: no match for 'operator[]' (operand types are 'std::vector<bool>::reference {aka std::_Bit_reference}' and 'int')
  dp[i][v] = get(i + 1, v) | get(i + 1, v + a[i]);
       ^
molecules.cpp:43:14: error: no match for 'operator[]' (operand types are 'std::vector<bool>::reference {aka std::_Bit_reference}' and 'int')
  return dp[i][v];
              ^
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:60:5: error: 'class std::vector<bool>' has no member named 'assing'; did you mean 'assign'?
  dp.assing(maxn, vector<bool>(maxn));
     ^~~~~~
     assign
molecules.cpp:61:6: error: 'class std::vector<bool>' has no member named 'assing'; did you mean 'assign'?
  vis.assing(maxn, vector<bool>(maxn));
      ^~~~~~
      assign