QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#828419 | #9914. 前往何方 | zhenjianuo2025 | Compile Error | / | / | C++20 | 2.2kb | 2024-12-23 16:33:02 | 2024-12-23 16:33:03 |
Judging History
answer
#include<bits/stdc++.h>
#include "wheretoreach.h"
using namespace std;
#define vec vector
#define pb push_back
#define eb emplace_back
#define siz(vec) ((int)(vec).size())
#define all(vec) (vec).begin(),(vec).end()
template<class T>
void operator +=(vec<T> &a,T b){a.push_back(b);}
template<class T>
void operator --(vec<T> &a){a.pop_back();}
#define pii pair<int,int>
#define x first
#define y second
#define mp make_pair
#define exc(exp) if(exp)continue;
#define stop(exp) if(exp)break;
#define ret(exp) if(exp)return;
#define deb(var) cerr<<#var<<'='<<(var)<<"; "
#define debl(var) cerr<<#var<<'='<<(var)<<";\n"
#define ins insert
#define era erase
#define lb lower_bound
#define inf (long long)(1e9)
template<class T>
bool Min(T &x,T y){return x>y?x=y,1:0;}
template<class T>
bool Max(T &x,T y){return x<y?x=y,1:0;}
int add(int x);
int remove(int x);
void report(int x,int y);
int n,vis[10010],tmp[10010],ins[10010];
void sol(int l,int r,vec<int> w){
ret(l>r);
int mid=(l+r)>>1;
vec<int> v;
if(l==1&&r==n){
v=w;
}else{
for(auto x:w)tmp[x]=0;
fill(vis+l,vis+r+1,0);
for(int T=1;;T++){
for(int i=l;i<=r;i++){
int x=add(i);
if(x>1)tmp[i]=1;
if(x>1||vis[i]){
remove(i);
}else{
ins[i]=1;
vis[i]=1;
}
}
for(auto x:w){
exc(tmp[x]);
if(x<=l){
}else if(x<=r){
}else{
if(add(x)>1)tmp[x]=1;
assert(remove(x)<=1);
}
}
for(int i=l;i<=r;i++){
if(ins[i]){
remove(i);
ins[i]=0;
}
}
if(count(vis+l,vis+r+1)==r-l+1)break;
}
for(auto x:w){
if(tmp[x])v+=x;
}
}
w=v;
if(l==r){
for(auto x:w){
report(l,x);
}
}else{
sol(l,mid,w);
sol(mid+1,r,w);
}
}
void solve(int N){
n=N;
vec<int> v(n-1);
iota(all(v),2);
sol(1,n,v);
}
详细
implementer.cpp: In function ‘void Interactor::init()’: implementer.cpp:25:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 25 | scanf("%d",&n); | ~~~~~^~~~~~~~~ implementer.cpp:30:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 30 | scanf("%d%d",&x,&y); v[x].push_back(y),v[y].push_back(x); | ~~~~~^~~~~~~~~~~~~~ answer.code: In function ‘void sol(int, int, std::vector<int>)’: answer.code:73:21: error: no matching function for call to ‘count(int*, int*)’ 73 | if(count(vis+l,vis+r+1)==r-l+1)break; | ~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from answer.code:1: /usr/include/c++/13/bits/stl_algo.h:4072:5: note: candidate: ‘template<class _IIter, class _Tp> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)’ 4072 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value) | ^~~~~ /usr/include/c++/13/bits/stl_algo.h:4072:5: note: template argument deduction/substitution failed: answer.code:73:21: note: candidate expects 3 arguments, 2 provided 73 | if(count(vis+l,vis+r+1)==r-l+1)break; | ~~~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/algorithm:73: /usr/include/c++/13/pstl/glue_algorithm_defs.h:101:1: note: candidate: ‘template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)’ 101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value); | ^~~~~ /usr/include/c++/13/pstl/glue_algorithm_defs.h:101:1: note: template argument deduction/substitution failed: answer.code:73:21: note: candidate expects 4 arguments, 2 provided 73 | if(count(vis+l,vis+r+1)==r-l+1)break; | ~~~~~^~~~~~~~~~~~~~~