QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#130632#6642. (1, 2) NimAsif17rWA 7ms3556kbC++203.3kb2023-07-24 18:09:122023-07-24 18:09:13

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-24 18:09:13]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3556kb
  • [2023-07-24 18:09:12]
  • 提交

answer

#pragma GCC optimize("unroll-loops,O3")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
const int mod = 1e9 + 7;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define sz(x) (int)(x).size()
#define endl '\n'
#define ll long long
typedef pair<int, int> pii;
typedef vector<int> vi;
#define in(_x) int _x; cin >> _x;
template<typename... T> void out(T&&... args) {((cout << args << " "), ...); cout << endl;}
#define inp(arr,n) vector<int>arr(n); for(auto &_a: arr) cin >> _a;
#define print(arr)  for(auto a: arr) cout << a<< " "; cout << endl;
#define pb emplace_back
#define all(x) x.begin(), x.end()
#define mp make_pair
#define f first
#define s second
//**************OPTIONAL******************
inline int uceil(int a,int b) {int res = a/b; if(a%b and res >= 0) res++; return res;}
#define set_bit(x, idx) x = x|(1LL<<idx)
int dx[8] = {0,1,0,-1,1,-1,1,-1};
int dy[8] = {-1,0,1,0,1,1,-1,-1};
#define toggle_bit(x, idx) x = x^(1LL<<idx)
#define check_bit(x, idx) min(x&(1LL<<idx),1LL)
#define mxheap priority_queue<int>
#define mnheap priority_queue<int, vector<int>, greater<int>>
#define mxheap2 priority_queue<pair<int,int>>
#define mnheap2 priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>>
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //__gnu_cxx::sfmt19937_64  #include <ext/random>
#define rng(x,y) uniform_int_distribution<int>(x,y)(rng)
ll ulog(ll val, ll base) {ll cnt = 0; val /= base; while(val) {cnt++; val /= base;} return cnt;}
#ifdef DEBUG
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#define pause(x) this_thread::sleep_for(chrono::milliseconds(x));
#define ios
#define dbg(...) {cerr << __LINE__ << " : " ;cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__);}
#define ok cerr << __LINE__ << " is done " << endl;
#else
#define pause(x) 
#define ios {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
#define dbg(...) 
#define ok
#endif
const int N =  -10    +5;


void solvetc(int tt){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    if(n == 1) {
        cout << "Sprague" << endl;
        return;
    }
    if(n == 2) {
        cout << "Grundy" << endl;
        return;
    }
    sort(all(a));
    int one = count(all(a), 1);
    if(one == n - 1 && n % 3 == 0) {
        cout << "Sprague" << endl;
        return;
    }
    cout << "Grundy" << endl;
}

int32_t main()
{
    ios ;
    #ifdef DEBUG  
    //~ freopen("in", "r", stdin);
    #endif
    int nn = 1;
    cin >> nn;
    rep(i,0, nn) solvetc(i+1);
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3552kb

input:

3
2
1 2
1
5
4
1 7 2 9

output:

Grundy
Sprague
Grundy

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 7ms
memory: 3556kb

input:

11337
9
4 1 2 3 2 4 3 2 3
10
1 7 1 5 1 2 2 2 1 3
9
1 3 7 3 3 1 1 3 2
12
1 1 2 4 1 2 2 4 2 2 1 4
15
1 3 4 3 1 2 1 4 1 1 1 1 1 1 1
8
3 3 2 2 3 9 1 2
10
2 2 2 2 1 5 1 2 7 2
10
2 2 2 3 2 2 3 5 2 2
7
2 2 6 2 2 3 5
10
1 1 1 3 1 1 1 5 1 1
8
2 2 2 2 5 2 10 1
5
3 10 1 3 1
8
3 4 2 2 1 1 11 1
6
6 4 8 2 4 2
10
...

output:

Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy...

result:

wrong answer 22nd lines differ - expected: 'Sprague', found: 'Grundy'