QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#575979#6789. Yet Another Game of StonesZhi_zICompile Error//C++172.6kb2024-09-19 17:43:562024-09-19 17:44:00

Judging History

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

  • [2024-09-19 17:44:00]
  • 评测
  • [2024-09-19 17:43:56]
  • 提交

answer

#include <bits/stdc++.h>

/* Orther */
#define int long long
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define IOS ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
using namespace std;

/* Pair */
#define x first
#define y second

/* Data type */
using ll = long long;
using ull = unsigned long long;
using PII = pair<int,int>;
using VI = vector<int>;

/* STL */
#define eb emplace_back
#define ef emplace_front
#define pb push_back
#define pf push_front
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define all1(x) x.begin()+1,x.end()

/* Random */
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define random(a,b) rng()%(b-a+1)+a

/* Contest */
const int INF = 0x3f3f3f3f ; // 1e9
const int MOD =  998244353 ;
const int N = 100005, M = 55;

#define Bob cout<<"Bob\n"
#define Alice cout<<"Alice\n"
int a[N] , b[N] ;
std::mt19937_64 rng {std::chrono::steady_clock::now().time_since_epoch().count()};

void Rainbow_()
{
    int n ; cin >> n;
    for (int i = 1; i <= n; i ++ ) {
    	cin >> a[i];
    }
    for (int i = 1; i <= n; i ++ ) {  
    
    
    
    	cin >> b[i];
    }
    
    bool ok = false ;
    int cnt1 = 0 , cnt2 = 0;

    for (int i = 1; i <= n ; i ++ ) {
    	if (a[i] % 2 && b[i] == 2) {
    // Alice 拿不了 这个 1
    		ok = true;
    	}
    // Alice 会在这里用一次(交换先后手)
    	if ( a[i] > 1 && b[i] == 1 ) {
    		cnt1 ++ ;
    	}
    // Alice 必定交换先后手 , 否则必输
    	if ( a[i] % 2 == 0 && b[i] == 2 ) {
    		cnt2 ++ ;
    	}
    }
    
    // 特殊点大于 1
    if (cnt1 + cnt2 > 1 || ok) {
    	Bob ;
    } else if (cnt1 == 0 && cnt2 == 0) { // 没有限制就是NIM游戏
    	int sum = 0;
    	for (int i = 1; i <= n; i ++ ) {
    		sum ^= a[i];
    	}
    	if (sum == 0) {
    		Bob ;
    	} else {
    		Alice ;
    	}
    } else if ( cnt1 == 0 && cnt2 == 1 ) { 
    	int sum = 0;
    	for (int i = 1; i <= n; i ++ ) {
    		if ( b[i] != 2 ) {
    			sum ^= a[i];
    		}
    	}
    	if (sum == 0) {
    		Alice ;
    	} else {
    		Bob ;
    	} 
    } else if (cnt1 == 1 && cnt2 == 0) {
    	int num = 0;
    	for (int i = 1; i <= n; i ++ ) {
    		if ( b[i] == 1 && a[i] > 1 ) {
    			if ( a[i] % 2 == 0 ) {
    				num ^= 1;
    			}
    		} else {
    			num ^= a[i];
    		}
    	}
    	if ( num == 0 ) {
    		Alice ;
    	} else {
    		Bob ;
    	}
    }
    
    return ;
}
 
signed main()
{   
    IOS;
    int _ = 1;
    cin >> _;
 
    while ( _ -- ) 
        Rainbow_();
 
    return 0;
}

详细

answer.code:42:17: error: conflicting declaration ‘std::mt19937_64 rng’
   42 | std::mt19937_64 rng {std::chrono::steady_clock::now().time_since_epoch().count()};
      |                 ^~~
answer.code:31:9: note: previous declaration as ‘std::mt19937 rng’
   31 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
      |         ^~~