QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#745964#9628. 骰子ganking#AC ✓0ms3700kbC++201.5kb2024-11-14 12:41:142024-11-14 12:41:19

Judging History

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

  • [2024-11-14 12:41:19]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3700kb
  • [2024-11-14 12:41:14]
  • 提交

answer

#include<bits/stdc++.h>
#define fo(i,a,b) for (ll (i)=(a);(i)<=(b);(i)++)
#define fd(i,b,a) for (ll (i)=(b);(i)>=(a);(i)--)
#define lc (o<<1)
#define rc ((o<<1)|1)
#define mk(x,y) make_pair((x),(y))
#define eb emplace_back
#define A puts("Yes")
#define B puts("No")
#define fi first
#define se second
using namespace std;
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long long i64;
const int N = 2e5 + 5;
const ll mo = 998244353;
ll n, m, f[21], fac[N], inv[N], h[N], g[N], u[N], v[N],ans;
bool vis[N];
void add(ll & x, ll y) {
    x = (x + y) % mo;
}
int find(int x){
    return x == f[x] ? x : f[x] = find(f[x]);
}
void work() {
    fo(i, 1, n) f[i] = i;
    fo(i, 1, m) {
        if (vis[i]) {
            int f1 = find(u[i]), f2 = find(v[i]);
            if (f1 ^ f2) {
                f[f1] = f2;
            }
        }
    }
    if (find(1) == find(2)) {
        int state = 0;
        fo(i, 1, n) if (find(i) == find(1)) {
            state |= 1 << (i - 1);
        }
        // g[state]++;
        if (state == 15) {
            fo(i, 1, m) cout << vis[i] << " ";
            cout << "\n";
        }

    }
}
void dfs(int x) {
    if (x > m) {
        work();
        return;
    }
    vis[x] = 1;
    dfs(x + 1);
    vis[x] = 0;
    dfs(x + 1);
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll n, m;
    cin >> n >> m;
    cout << n * m * 6;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 2

output:

24

result:

ok single line: '24'

Test #2:

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

input:

1000 1000

output:

6000000

result:

ok single line: '6000000'

Test #3:

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

input:

987 654

output:

3872988

result:

ok single line: '3872988'