QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#313266#4832. Telepathyminhnhatnoe0 7ms4164kbC++141.1kb2024-01-24 16:58:322024-01-24 16:58:32

Judging History

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

  • [2024-01-24 16:58:32]
  • 评测
  • 测评结果:0
  • 用时:7ms
  • 内存:4164kb
  • [2024-01-24 16:58:32]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

namespace backtrack{
    int x = -1;
    vector<int> result;

    void dfs(vector<int> &a){
        if (a.size() == 8){
            int v = 0;
            for (int i=0; i<(1 << 3); i++){
                for (int j=0; j<(1 << 3); j++){
                    bool value1 = j & (1 << a[i]);
                    bool value2 = i & (1 << a[j]);
                    v += value1 != value2;
                }
            }
            if (x < v){
                x = v;
                result = a;
            }
            return;
        }
        for (int i=0; i<3; i++){
            a.push_back(i);
            dfs(a);
            a.pop_back();
        }
    }

    void init(){
        vector<int> a;
        dfs(a);
    }
}

signed main(){
    cin.tie(0)->sync_with_stdio(0);
    backtrack::init();

    string s; int n, k;
    cin >> s >> n >> k >> s;

    for (int i=0, pos=0; i<k; i++, pos += 3){
        int x = (s[pos] - '0') + (s[pos+1] - '0') * 2 + (s[pos+2] - '0') * 4;
        cout << pos + backtrack::result[x]+1 << " \n"[i == k-1];
    }
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 7ms
memory: 4164kb

input:

Flim
1000000 100000
1101111111100010011110111001110011110110100000111110011111111111110111110100000001001000000110111000000101110000001100111110100100000100010111001011111010001000101100101100001111011100110010010000100100100101110100100110101001001000001011111101111111001100101000010110001011011000...

output:

2 4 7 11 13 16 19 24 26 28 31 34 39 42 43 48 49 52 55 58 61 64 69 70 75 76 79 83 86 88 93 96 98 100 105 106 109 112 116 120 121 126 129 130 135 136 141 143 145 148 151 154 158 162 164 168 170 172 175 178 182 186 187 190 193 198 201 204 207 208 213 216 219 222 224 227 230 232 235 238 242 244 247 251 ...

input:

Flam
1000000 100000
0000001101000100010010001001011111000101010011011001010100101001110101001011001011100001011100110100011110011010100101110101101101100101111011000111001101001100010000010010101110101010111110001100110000110001001111010010000010111101110001011011101101010000111111011111100100010001...

output:

1 4 8 11 15 16 19 22 26 28 31 35 39 40 43 46 50 52 57 60 62 64 69 71 73 77 79 83 85 88 92 96 99 100 103 106 109 114 117 118 123 125 128 131 135 136 139 143 147 149 152 155 158 160 163 166 169 174 175 180 181 186 187 190 194 198 199 204 205 209 211 214 217 220 223 228 230 232 235 238 241 245 248 250 ...

result:

wrong answer 31203 matched, but you need to match at least 66666 positions