QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#406866 | #5089. 环覆盖 | valeriu# | 0 | 1ms | 3520kb | C++20 | 1.1kb | 2024-05-07 19:25:55 | 2024-05-07 19:25:55 |
answer
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using ld = long double;
//#define int ll
#define sz(x) ((int)(x).size())
using pii = pair<int,int>;
using tii = tuple<int,int,int>;
const int nmax = 26;
vector<pii> edgs;
int rez[nmax];
void bkt(int ones, int twos, int p) {
if(p == sz(edgs)) {
if(ones) return;
rez[__builtin_popcount(twos)]++;
return;
}
bkt(ones, twos, p + 1);
int a = (1 << edgs[p].first), b = (1 << edgs[p].second);
if(twos & a) return;
else if(ones & a) ones &= ~a, twos |= a;
else ones |= a;
if(twos & b) return;
else if(ones & b) ones &= ~b, twos |= b;
else ones |= b;
bkt(ones, twos, p + 1);
}
signed main() {
cin.tie(0) -> sync_with_stdio(0);
int n, m;
cin >> n >> m;
edgs.resize(m);
for(auto &[a, b] : edgs) cin >> a >> b, --a, --b;
bkt(0, 0, 0);
for(int i = 0; i <= n; i++)
cout << rez[i] << ' ';
cout << '\n';
}
/**
Istenem! Nu poate fi real.
-- Surse verificate
*/
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3520kb
input:
10 9 3 5 3 10 4 7 4 8 5 6 5 9 6 9 7 9 9 10
output:
1 0 0 1 1 1 0 0 0 0 0
result:
wrong answer Output contains longer sequence [length = 11], but answer contains 10 elements
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Time Limit Exceeded
Test #31:
score: 0
Time Limit Exceeded
input:
25 45 1 6 1 12 1 17 2 3 2 4 2 6 3 6 3 8 4 5 4 12 4 16 5 17 6 21 7 14 7 22 7 23 8 15 8 19 8 24 9 11 9 19 9 23 9 25 10 17 10 18 11 16 11 19 11 22 12 19 13 18 14 19 15 19 16 24 17 19 17 22 17 25 18 19 18 21 18 24 19 23 20 22 21 25 22 23 23 25 24 25
output:
result:
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%