QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#884924 | #9689. 伪伪随机 | 275307894a | Compile Error | / | / | C++20 | 2.1kb | 2025-02-06 11:49:32 | 2025-02-06 11:49:32 |
Judging History
This is the latest submission verdict.
- [2025-02-06 11:49:32]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-02-06 11:49:32]
- Submitted
answer
6#include "prg.h"
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1e3+5,M=2e5+5,K=1000+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=2e9+7;mt19937 rnd(28382);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
#ifdef LOCAL
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
#else
#define gdb(...) void()
#endif
}using namespace Debug;
int qry(int x,int y,int op){
if(op==0) return x&y;
if(op==1) return x|y;
return x^y;
}
pii calc(vector<int> op){
int c0=0,c1=0;
int k=op.size()+1;
for(int i=0;i<(1<<k);i++){
int w=i&1;
for(int j=1;j<k;j++) w=qry(w,i>>j&1,op[j-1]);
(w?c1:c0)++;
}
return make_pair(c0,c1);
}
int solve(int n,int m,int k,vector<int> op,array<vector<int>,3000> x,int c,array<array<int,3000>,25> s){
db p=-log(1.0/2)*m*c;
auto [t0,t1]=calc(op);
if(t0^t1){
for(int i=0;i<c;i++){
for(int j=0;j<m;j++){
p+=log((s[i][j]?t1:t0)*1.0/(t0+t1));
}
}
}else{
op.pop_back();
auto [t0,t1]=calc(op);
gdb(t0,t1);
if(t0^t1){
for(int i=0;i<c;i++){
static int cnt[N][2];
Me(cnt,0);
for(int j=0;j<m;j++) cnt[x[j].back()][s[i][j]]++;
for(int j=0;j<n;j++){
db w=pow(t0*1.0/(t0+t1),cnt[j][0])*pow(t1*1.0/(t0+t1),cnt[j][1]);
w+=pow(t0*1.0/(t0+t1),cnt[j][1])*pow(t1*1.0/(t0+t1),cnt[j][0]);
p+=log(w*0.5);
}
}
}else return rnd()&1?1:2;
}
return p>0?2:1;
}
// i=prg;g++ -o $i grader.cpp $i.cpp -std=c++17 -DLOCAL -O2&& ./$i < 1.in
详细
answer.code:1:2: error: stray ‘#’ in program 1 | 6#include "prg.h" | ^ answer.code:1:1: error: expected unqualified-id before numeric constant 1 | 6#include "prg.h" | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from answer.code:3: /usr/include/c++/14/ext/type_traits.h:164:35: error: ‘constexpr const bool __gnu_cxx::__is_null_pointer’ redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration ‘template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)’ 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: ‘nullptr_t’ is not a member of ‘std’; did you mean ‘nullptr_t’? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: ‘nullptr_t’ declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: ‘nullptr_t’ is not a member of ‘std’; did you mean ‘nullptr_t’? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: ‘nullptr_t’ declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: ‘size_t’ declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1438:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: ‘size_t’ declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1440:26: error: ‘std::size_t’ has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: ‘_Size’ was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: ‘size_t’ declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_tr...