QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#725817#7626. Quake and RebuildscallionsongCompile Error//C++144.5kb2024-11-08 20:08:592024-11-08 20:09:00

Judging History

你现在查看的是最新测评结果

  • [2024-11-20 20:27:49]
  • hack成功,自动添加数据
  • (/hack/1219)
  • [2024-11-08 20:09:00]
  • 评测
  • [2024-11-08 20:08:59]
  • 提交

answer

bool M1;
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ull unsigned long long
#define LL __int128
#define db double
#define LD long double
#define Pii pair<int,int>
#define Pll pair<ll,ll>
#define Pull pair<ull,ull>
#define Pdb pair<db,db>
#define fir first
#define sec second
#define vec vector<int>
#define pb push_back
#define qlr cerr<<"qlr\n"
#define dyh cerr<<"dyh\n"
#define pc(x) __builtin_popcount(x)
#define uni(x,y) uniform_int_distribution<int>(x,y)(rng)
#define unl(x,y) uniform_int_distribution<ll>(x,y)(rng)
#define unr(x,y) uniform_real_distribution<double>(x,y)(rng)
#define F(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
#define UF(i,a,b) for(int i=a,i##end=b;i>=i##end;i--)
#define look_memory cerr<<'\n'<<abs(&M1-&M2)/1024.0/1024<<'\n'
#define look_time cerr<<'\n'<<clock()*1.0/CLOCKS_PER_SEC<<'\n'
mt19937 rng(time(0)^(*new int));
const int INF=0x3f3f3f3f;
const int Mod=998244353;
template<typename T>
inline void inc(T &a,T b){
	if(b<0) b+=Mod;
	a+=b;
	if(a>=Mod) a-=Mod;
}
template<typename T>
inline void dec(T &a,T b){
	if(b<0) b+=Mod;
	a-=b;
	if(a<0) a+=Mod;
}
template<typename T>
inline void muc(T &a,T b){
	a=a*b%Mod;
}
template<typename T>
inline bool chkmin(T &a,T b){
	if(a<=b) return false;
	a=b;
	return true;
}
template<typename T>
inline bool chkmax(T &a,T b){
	if(a>=b) return false;
	a=b;
	return true;
}
int n,q;
struct Blk{
    #define N 200000
    #define sq 100
    #define B N/sq
    int w1[N+10],w2[N+10],w3[N+10];
    int tag1[B+10],tag2[B+10];
    gp_hash_table<int,int> mp[B+10];
    int id(int x){
        return (x-1)/sq+1;
    }
    int l(int x){
        return (x-1)*sq+1;
    }
    int r(int x){
        return min(x*sq,n);
    }
    void down(int k){
        F(i,l(k),r(k)) w1[i]+=tag2[k];
        tag2[k]=0;
    }
    void update(int k){
        F(i,l(k),r(k)){
            if(id(w1[i])!=k) w2[i]=w1[i],w3[i]=1;
            else w2[i]=w2[w1[i]],w3[i]=w3[w1[i]]+1;
        }
    }
    void build(){
        F(i,1,id(n)) update(i);
    }
    void modify(int k,int x,int y,int z){
        down(k);
        F(i,l(k),r(k)) if(i>=x&&i<=y) w1[i]=max(w1[i]-z,1);
        update(k);
    }
    void change(int x,int y,int z){
        if(id(x)==id(y)){
            modify(id(x),x,y,z);
            return;
        }
        modify(id(x),x,y,z),modify(id(y),x,y,z);
        F(i,id(x)+1,id(y)-1){
            if(tag1[i]<sq) modify(i,x,y,z);
            else tag2[i]-=z;
//            tag1[i]+=z;
        }
    }
    bool chk(int k){
        gp_hash_table<int,int> tg;
        for(auto i:mp[k]){
            int nxt=max(w2[i.fir]+tag2[k],1);
            if(tg[nxt]) return 0;
            tg[nxt]=1;
        }
        return 1;
    }
    int query(vec V){
        F(i,1,id(n)) mp[i].clear();
        int mi=INF; 
        for(auto i:V) mp[id(i)][i]=1,chkmin(mi,i);
        int res=0;
        UF(i,id(n),1){
            if(mp[i].empty()) continue;
            if(chk(i)){
                for(auto j:mp[i]){
                	if(j==mi) break;
                    res+=w3[j.fir];
                    int nxt=max(w2[j.fir]+tag2[i],1);
                    mp[id(nxt)][nxt]=1;
                    chkmin(mi,nxt);
                }
            }
            else{
                UF(j,r(i),l(i)){
                	if(!mp[i][j]) continue;
                	if(j==mi) break;
					res++;
					int nxt=max(w1[j]+tag2[i],1);
					mp[id(nxt)][nxt]=1;
					chkmin(mi,nxt);
				}
            }
        }
        return res;
    }
    #undef N
    #undef sq
    #undef B
}blk;
bool M2;
int main(){
	// freopen("aminusb.in","r",stdin);
	// freopen("aminusb.out","w",stdout);
	srand(time(0)^(*new int));
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    cin>>n>>q;
    blk.w1[1]=1;
    F(i,2,n) cin>>blk.w1[i];
    blk.build();
    while(q--){
        int op,x,y,z;
        vec V;
        cin>>op;
        if(op==1) cin>>x>>y>>z,blk.change(x,y,z);
        else{
            cin>>x;
            V.resize(x);
            F(i,0,x-1) cin>>V[i];
            cout<<blk.query(V)<<'\n';
        }
    }
	look_memory;
	look_time;
	return 0;
}
/*
g++ B1.cpp -o B1 -std=c++14 -O2&&./B1

4 5
1 2 2
2 2 1 4
1 2 3 1
2 3 2 3 4
1 4 4 1
2 2 3 4

10 10
1 2 3 3 4 5 7 7 9
1 2 10 3
2 9 9 5 3 10 7 2 4 6 8
1 6 10 3
1 2 7 3
1 7 10 3
2 2 4 3
2 3 7 4 4
1 3 9 3
1 3 9 3
1 10 10 3
*/

詳細信息

answer.code: In member function ‘int Blk::query(std::vector<int>)’:
answer.code:126:29: error: no match for ‘operator==’ (operand types are ‘std::pair<const int, int>’ and ‘int’)
  126 |                         if(j==mi) break;
      |                            ~^~~~
      |                            |  |
      |                            |  int
      |                            std::pair<const int, int>
In file included from /usr/include/c++/13/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:181,
                 from answer.code:2:
/usr/include/c++/13/bits/regex.h:1103:5: note: candidate: ‘template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)’
 1103 |     operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1103:5: note:   template argument deduction/substitution failed:
answer.code:126:31: note:   ‘std::pair<const int, int>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
  126 |                         if(j==mi) break;
      |                               ^~
/usr/include/c++/13/bits/regex.h:1199:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)’
 1199 |     operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1199:5: note:   template argument deduction/substitution failed:
answer.code:126:31: note:   ‘std::pair<const int, int>’ is not derived from ‘std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>’
  126 |                         if(j==mi) break;
      |                               ^~
/usr/include/c++/13/bits/regex.h:1274:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’
 1274 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1274:5: note:   template argument deduction/substitution failed:
answer.code:126:31: note:   ‘std::pair<const int, int>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
  126 |                         if(j==mi) break;
      |                               ^~
/usr/include/c++/13/bits/regex.h:1366:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)’
 1366 |     operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1366:5: note:   template argument deduction/substitution failed:
answer.code:126:31: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘int’
  126 |                         if(j==mi) break;
      |                               ^~
/usr/include/c++/13/bits/regex.h:1441:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’
 1441 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1441:5: note:   template argument deduction/substitution failed:
answer.code:126:31: note:   ‘std::pair<const int, int>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
  126 |                         if(j==mi) break;
      |                               ^~
/usr/include/c++/13/bits/regex.h:1534:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)’
 1534 |     operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1534:5: note:   template argument deduction/substitution failed:
answer.code:126:31: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘int’
  126 |                         if(j==mi) break;
      |                               ^~
/usr/include/c++/13/bits/regex.h:1613:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)’
 1613 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1613:5: note:   template argument deduction/substitution failed:
answer.code:126:31: note:   ‘std::pair<const int, int>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
  126 |                         if(j==mi) break;
      |                               ^~
/usr/include/c++/13/bits/regex.h:2186:5: note: candidate: ‘template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)’
 218...