제출 #1349913

#제출 시각아이디문제언어결과실행 시간메모리
1349913alish_1Mars (APIO22_mars)C++20
0 / 100
0 ms3212 KiB
#include <bits/stdc++.h>
#include "mars.h"
#define ll long long
#define ull unsigned long long
#define pb push_back
#define sln cout << "\n";
#define sz(x) (int)(x.size())
#define s second
#define ld long double
#define f first
#define pt complex <ld>
#define cyes cout << "YES\n";
#define cno cout << "NO\n";
#define bitcount __builtin_popcountll
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#pragma comment (linker, "/stack:200000")

#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unswitch-loops")
#pragma GCC target ("avx2")

//#pragma GCC optimize("O3, unroll-loops, Ofast")
//#pragma GCC target("avx, avx2, fma")
//#pragma GCC optimize("no-exceptions")
//#pragma GCC optimize("no-rtti")
//#pragma GCC optimize("stack-reuse=all")


//#define int ll //__int128_t
#define lll __int128_t
using namespace std;
const ll mod = 1e9 + 7;
ld pi = acos(-1);
ll inf = (ll)1e18;
ll binpow (ll n, ll s) {
    n %= mod;
    ll t = n;
    ll ans = 1LL;
    while (s > 0LL) {
        if ((s & 1)) {
            ans = (ans * t) % mod;
        }
        t = (t * t) % mod;
        s = (s >> 1LL);
    }
    return ans;
}
int lg (ll n) {
    return 63 - __builtin_clzll(n);
}
ll lcm (ll a, ll b) {
    return (a * b / __gcd (a, b));
}
string process(vector <vector <string>> a, int i1, int j1, int k, int n) {
    string s = a[0][0];
    if (i1 + j1 == 0) {
        vector <vector <int>> was(n * 2 + 1, vector <int> (n * 2 + 1, 0));
        vector <vector <int>> c(n * 2 + 1, vector <int> (n * 2 + 1, 0));
        for (int i = 0; i < 100; i ++) {
            if (a[0][0][i] == '1') {
                c[i / (2 * n + 1)][i % (2 * n + 1)] = 1;
            }
        }
        int ans = 0;
        for (int i = 0; i < n * 2 + 1; i ++) {
            for (int j = 0; j < n * 2 + 1; j ++) {
                if (was[i][j]) continue;
                queue <pair <int, int>> b;
                b.push ({i, j});
                ans ++;
                while (!b.empty()) {
                    vector <pair <int, int>> to;
                    int x = b.front().f;
                    int y = b.front().s;
                    was[x][y] = 1;
                    b.pop();
                    to.pb ({x - 1, y});
                    to.pb ({x + 1, y});
                    to.pb ({x, y - 1});
                    to.pb ({x, y + 1});
                    for (auto [tox, toy] : to) {
                        if (max (tox, toy) > n * 2 || min (tox, toy) < 0) continue;
                        if (was[tox][toy] == 1) continue;
                        if (c[tox][toy] == 0) continue;
                        b.push ({tox, toy});

                        was[tox][toy] = 1;
                    }
                }
            }
        }
        for (int i = 0; i < 100; i ++) {
            if (((ans >> i) & 1)) s[i] = '1';
            else s[i] = '0';
        }
        return s;
    }
    s[0] = '0';
    if (a[0][0][0] == '1') {
        s[i1 * (2 * n + 1) + j1] = '1';
    }
    for (int i = 0; i < 3; i ++) {
        for (int j = 0; j < 3; j ++) {
            for (int k = 0; k < 100; k ++) {
                if (a[i][j][k] == '1') {
                    s[k] = '1';
                }
            }
        }
    }
    return s;
}
/*
()(())

(())()()

g++ grader.cpp problem.cpp -o program.exe -std=c++17
program.exe

-1 1 -1 -1 1 -1

-1 1 -1 1 -1 1 -1 -1



0 1 2 3 4
32
0 1 2 3 4
0 1 2 4 3
0 1 4 2 3
1 0 0 1 0 0 1 0












6 4
1 2 4 3 5 6
1 2 3 4 5 6





















((()))()()


*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...