QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#417843#8416. Dzielniki [B]QingyuCompile Error//C++233.2kb2024-05-22 23:25:462024-05-22 23:53:17

Judging History

你现在查看的是测评时间为 2024-05-22 23:53:17 的历史记录

  • [2024-05-22 23:59:47]
  • 管理员手动重测该提交记录
  • 测评结果:10
  • 用时:25ms
  • 内存:4020kb
  • [2024-05-22 23:53:17]
  • 管理员手动重测本题所有提交记录
  • [2024-05-22 23:52:20]
  • 管理员手动重测该提交记录
  • [2024-05-22 23:25:48]
  • 评测
  • 测评结果:1
  • 用时:2297ms
  • 内存:4016kb
  • [2024-05-22 23:25:46]
  • 提交

answer

#include<bits/stdc++.h>
#include "dzilib.h"
 
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("trapv")
 
#define st first
#define nd second
#define pb push_back
#define pp pop_back
#define eb emplace_back
#define mp(a, b) make_pair(a, b)
#define all(x) (x).begin(), (x).end()
#define rev(x) reverse(all(x))
#define sor(x) sort(all(x))
#define sz(x) (int)(x).size()
#define rsz(x) resize(x)
 
using namespace std;
 
///~~~~~~~~~~~~~~~~~~~~~~~~~~
 
template <typename H, typename T> 
ostream& operator<<(ostream& os, pair<H, T> m){
    return os <<"("<< m.st<<", "<<m.nd<<")";
}
template <typename H> 
ostream& operator<<(ostream& os, vector<H> V){
    os<<"{";
    for(int i=0; i<V.size(); i++){
        if(i)os<<" ";
        os<<V[i];
    }
    os<<"}";
    return os;
}
 
void debug(){cerr<<"\n";}
template <typename H, typename... T>
void debug(H h, T... t) {cerr<<h; if (sizeof...(t)) cerr << ", "; debug(t...);}
#define deb(x...) cerr<<#x<<" = ";debug(x);
 
///~~~~~~~~~~~~~~~~~~~~~~~~~
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii > vii;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef string str;
 
#define BOOST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

ll los(ll a, ll b){
    if(a>b)swap(a, b);
    unsigned long long t=rng();
    t<<=31;
    t+=rng();
    return a+(t%(b-a+1));
}

int ile(ll a){
	return __builtin_ctzll(a);
}
/*
g++ -O3 -static -o dzi dzi.cpp dzilib.cpp -std=c++20
*/
int main() {
	//deb(ile(1), ile(6),ile(4));
	//return 0;
    int tt = GetT();
    int Q = GetQ();
    long long C = GetC();
    long long N = GetN();
    while(tt--) {
        ll x=los(0, 10*N);
        ll potm=1, potM=1024;
        vector<ll> V(potM);
        iota(all(V), 0);
        vector<pair<ll, int>> ans;
        while(true){
        	//x=((V[0]+potm-1)/potm)*potm;
        	deb(ans.size());
        	if((V[0]+x)%potm){
        		ll t=(V[0]+x)%potm;
        		x+=potm-t;
        	}
        	ans.pb({x, Ask(x)});
        	x++;
        	//deb(ans, potm, potM, V);
        	vector<ll> V2;
        	for(ll &i:V){
        		int a=ile(ans.back().st+i);
        		//assert((1ll<<a)>=potm);
        		if((1ll<<a)<potM && ans.back().nd%(a+1)){

        		}
        		else V2.pb(i);
        	}
        	V=V2;
        	V2.clear();
        	//deb(V, potm, potM);
        	bool b=1;
        	for(ll &i:V){
        		if((i-V[0])%(2*potm)){
        			b=0;
        		}
        	}
        	if(b){
        		for(ll &i:V){
        			if(i+potM<=N)V2.pb(i+potM);
        		}
        		for(ll &i:V2)V.pb(i);
        		V2.clear();
        		//deb(V);
        		potm*=2;
        		potM*=2;
        		for(ll &i:V){
	        		b=1;
	        		for(auto &j:ans){
	        			int a=ile(j.st+i);
	        			if((1ll<<a)<potM && j.nd%(a+1)){
	        				b=0;
	        			}
        			}
        			if(b)V2.pb(i);
        		}
        		V=V2;
        		//assert(V.size());
        	}
        	if(V.size()==1 && potM>=N)break;
        }
        Answer(V[0]);
    }
    return 0;
}

詳細信息

implementer.cpp:49:43: error: ‘initializer_list’ in namespace ‘std’ does not name a template type
   49 | bool miller_rabin( uint64_t n, const std::initializer_list<uint64_t>& as ) {
      |                                           ^~~~~~~~~~~~~~~~
implementer.cpp:49:59: error: expected ‘,’ or ‘...’ before ‘<’ token
   49 | bool miller_rabin( uint64_t n, const std::initializer_list<uint64_t>& as ) {
      |                                                           ^
implementer.cpp: In function ‘bool {anonymous}::miller_rabin(uint64_t, int)’:
implementer.cpp:50:17: error: ‘all_of’ is not a member of ‘std’
   50 |     return std::all_of( as.begin(), as.end(), [n]( uint64_t a ) {
      |                 ^~~~~~
implementer.cpp:50:25: error: ‘as’ was not declared in this scope; did you mean ‘abs’?
   50 |     return std::all_of( as.begin(), as.end(), [n]( uint64_t a ) {
      |                         ^~
      |                         abs
implementer.cpp: In function ‘bool {anonymous}::is_prime(uint64_t)’:
implementer.cpp:70:47: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘int’
   70 |     if( n < 4759123141 ) { return miller_rabin( n, { 2, 7, 61 } ); }
      |                                   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
      |                                               |
      |                                               <brace-enclosed initializer list>
implementer.cpp:49:32: note:   initializing argument 2 of ‘bool {anonymous}::miller_rabin(uint64_t, int)’
   49 | bool miller_rabin( uint64_t n, const std::initializer_list<uint64_t>& as ) {
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
implementer.cpp:71:24: error: cannot convert ‘<brace-enclosed initializer list>’ to ‘int’
   71 |     return miller_rabin( n, { 2, 325, 9375, 28178, 450775, 9780504, 1795265022 } );
      |            ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                        |
      |                        <brace-enclosed initializer list>
implementer.cpp:49:32: note:   initializing argument 2 of ‘bool {anonymous}::miller_rabin(uint64_t, int)’
   49 | bool miller_rabin( uint64_t n, const std::initializer_list<uint64_t>& as ) {
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
implementer.cpp: At global scope:
implementer.cpp:166:34: error: ‘std::vector’ has not been declared
  166 | void factorize_impl( uint64_t n, std::vector<uint64_t>& ret ) {
      |                                  ^~~
implementer.cpp:166:45: error: expected ‘,’ or ‘...’ before ‘<’ token
  166 | void factorize_impl( uint64_t n, std::vector<uint64_t>& ret ) {
      |                                             ^
implementer.cpp: In function ‘void {anonymous}::factorize_impl(uint64_t, int)’:
implementer.cpp:168:27: error: ‘ret’ was not declared in this scope
  168 |     if( is_prime( n ) ) { ret.push_back( n ); return; }
      |                           ^~~
implementer.cpp:172:24: error: ‘ret’ was not declared in this scope
  172 |     factorize_impl( p, ret );
      |                        ^~~
implementer.cpp: At global scope:
implementer.cpp:176:6: error: ‘vector’ in namespace ‘std’ does not name a template type
  176 | std::vector<uint64_t> factorize( uint64_t n ) {
      |      ^~~~~~
implementer.cpp:5:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
    4 | #include <cstdint>
  +++ |+#include <vector>
    5 | static int T = 0;
implementer.cpp: In function ‘long long int Ask(long long int)’:
implementer.cpp:253:14: error: ‘vector’ is not a member of ‘std’
  253 |         std::vector<uint64_t> o=factorize(num);
      |              ^~~~~~
implementer.cpp:253:14: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
implementer.cpp:253:29: error: expected primary-expression before ‘>’ token
  253 |         std::vector<uint64_t> o=factorize(num);
      |                             ^
implementer.cpp:253:31: error: ‘o’ was not declared in this scope
  253 |         std::vector<uint64_t> o=factorize(num);
      |                               ^
implementer.cpp:253:33: error: ‘factorize’ was not declared in this scope
  253 |         std::vector<uint64_t> o=factorize(num);
      |                                 ^~~~~~~~~
implementer.cpp:254:14: error: ‘map’ is not a member of ‘std’
  254 |         std::map<long long,long long> mp;
      |              ^~~
implementer.cpp:5:1: note: ‘std::map’ is defined in header ‘<map>’; did you forget to ‘#include <map>’?
    4 | #include <cstdint>
  +++ |+#include <map>
    5 | static int T = 0;
implementer.cpp:254:18: error: expected primary-expression before ‘long’
  254 |         std::map<long long,long long> mp;
      |                  ^~~~
implementer.cpp:255:30: error: ‘mp’ was not declared in this scope
  255 |         for(long long i:o) ++mp[i];
      |                              ^~
implementer.cpp:256:24: error: ‘mp’ was not declar...