QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#379188#8566. Can We Still Qualify For Semifinals?ucup-team228#WA 0ms3816kbC++203.8kb2024-04-06 16:32:212024-04-06 16:32:23

Judging History

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

  • [2024-04-06 16:32:23]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-04-06 16:32:21]
  • 提交

answer

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx2") // doesn't work on Yandex
//#pragma GCC target("avx") // for old judges
//#pragma GCC target("bmi,bmi2,lzcnt,popcnt") // fast bit operations

#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <chrono>
#include <random>
#include <string>
#include <numeric>
#include <complex>
#include <tuple>
#include <utility>
#include <bitset>
#include <array>
#include <stack>
#include <sstream>
#include <unordered_set>

using namespace std;
typedef long long ll;

string to_string(string a) { return '"' + a + '"'; }
string to_string(char a) { return "'" + string(1, a) + "'"; }
string to_string(const char* a) { return to_string((string) a); }
string to_string(bool a) { return a ? "true" : "false"; }
template <class T1, class T2>
string to_string(pair<T1, T2> a) {
    return "(" + to_string(a.first) + ", " + to_string(a.second) + ")";
}
template <class T>
string to_string(T a) {
    bool first = true; string res = "{";
    for (const auto& i : a) {
        if (!first) res += ", ";
        first = false;
        res += to_string(i);
    }
    res += "}";
    return res;
}
void debug_out() { cerr << endl; }
template <class T1, class... T2>
void debug_out(T1 a, T2... b) {
    cerr << " " << to_string(a);
    debug_out(b...);
}

#ifdef LOCAL
#define out(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define out(...) 42
#endif

clock_t start_time; void start_timer() { start_time = clock(); }
double get_time() { return (double) (clock() - start_time) / CLOCKS_PER_SEC; }

void Solve();

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("usr/share/man/man1/input.txt", "r", stdin);
#endif
    start_timer();
    Solve();
#ifdef LOCAL
    cerr << fixed << setprecision(3);
    cerr << endl << "Time spent: " << get_time() << endl;
#endif
    return 0;
}

// do something, stay focused
// look for stupid bugs
// guess, slow, stress
// don't overgeneralize
// don't rush

// don't waste time on standings

// SOLVE THE PROBLEM OR DIE TRYING
// THE SOLUTION IS ALWAYS SIMPLE
// THE CODE IS ALWAYS SHORT

const int N = 10;

vector<int> p;
vector<pair<int, int>> ms;
pair<int, int> cnt[N + 1];

void Solve() {
    p.resize(10);
    iota(p.begin(), p.end(), 1);
    for (int r = 1; r <= 9; r++) {
        for (int i = 0; i <= 4; i++) {
            ms.push_back({p[i], p[9 - i]});
        }
        int last = p.back();
        for (int i = 9; i >= 2; i--) {
            p[i] = p[i - 1];
        }
        p[1] = last;
    }
    int T;
    cin >> T;
    while (T--) {
        for (int i = 1; i <= N; i++) {
            cnt[i] = {0, i};
        }
        int k;
        cin >> k;
        for (int i = 0; i < k; i++) {
            auto [x, y] = ms[i];
            char c;
            cin >> c;
            if (c == '1') {
                cnt[x].first++;
            }
            else {
                cnt[y].first++;
            }
        }
        for (int i = k; i < ms.size(); i++) {
            auto [x, y] = ms[i];
            if (x == 1 || y == 1) {
                cnt[1].first++;
            }
            else if (cnt[x].first < cnt[y].first) {
                cnt[x].first++;
            }
            else {
                cnt[y].first++;
            }
        }
        int india = cnt[1].first;
        sort(cnt + 1, cnt + N + 1);
        int fourth = cnt[7].first;
        if (india >= fourth) {
            cout << "YES\n";
        }
        else {
            cout << "NO\n";
        }
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3660kb

input:

3
3
111
25
1000010101111111111010100
35
01111011110111101111011110111101111

output:

YES
YES
NO

result:

ok 3 token(s): yes count is 2, no count is 1

Test #2:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

10
16
0110000001010100
17
01111000110110101
15
001100010101111
16
0010101010011100
19
0000000100010110100
16
0011101010011100
18
011110010001100000
18
000110101001100011
20
01100010000100100100
15
001000111001101

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #3:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

10
37
0110000001010100011101001011100110001
39
000100111101101001100101101000000000100
35
00111000100111100101011010111100100
33
010000010001110010110001101110001
30
000100010100000010010110101010
31
0000101000011010101001010000000
44
00001000000111101011010110000101100011000100
42
01111011110001001...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3732kb

input:

10
23
01100000010101000111010
38
01111001100011000101011110101001101001
27
010000000001001001110001001
26
01101001110011101101000110
8
00001000
22
0110100110001110110001
9
000100010
24
000000100101101010100100
6
011000
29
01101010100101000000000000100

output:

NO
NO
NO
NO
YES
NO
YES
NO
YES
NO

result:

wrong answer expected YES, found NO [1st token]