제출 #1364379

#제출 시각아이디문제언어결과실행 시간메모리
1364379saywooSecond Run (KAISTRUN26SPRING_A)C++20
100 / 100
22 ms5340 KiB
#include <bits/stdc++.h>
using namespace std;

using ll = long long int;

ll n, m;
ll x[101010][4], k[101010];
ll a[101010];

struct Random {
    mt19937 rd;
    Random() : rd(chrono::steady_clock::now().time_since_epoch().count()){}
    int randInt(int l, int r) { return uniform_int_distribution<int>(l, r)(rd); }
} rd;

int epoch = 500;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> n >> m;

    for (int i = 0; i < m; i++) {
        for (int j = 0; j < 4; j++) cin >> x[i][j];
        cin >> k[i];
    }

    while (epoch--) {
        for (int i = 1; i <= n; i++) a[i] = rd.randInt(0, 3);
        
        int cnt = 0;
        for (int i = 0; i < m; i++) {
            int tmp = 0;
            for (int j = 0; j < 4; j++) tmp += a[x[i][j]];
            if (tmp % 4 == k[i]) cnt++;
        }
        if (cnt >= m / 4) {
            for (int i = 1; i <= n; i++) cout << a[i] << " ";
            return 0;
        }
    }

    return 0;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…