답안 #1095172

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1095172 2024-10-01T13:21:26 Z thangdz2k7 Super Dango Maker (JOI22_dango3) C++17
0 / 100
2467 ms 840 KB
// author : thembululquaUwU
// 3.9.2024

#include <bits/stdc++.h>
#include "dango3.h"
#define pb push_back
#define fi first
#define se second
#define endl '\n'

using namespace std;
using ll = long long;
using ii = pair <int, int>;
using vi = vector <int>;

const int MaxN = 2e5;
const int mod = 1e9 + 7;

void maxl(auto &a, auto b) {a = max(a, b);}
void minl(auto &a, auto b) {a = min(a, b);}

bool w(vector <int> v, int N, int M){
    vi used(N * M, 0);
    for (int &t : v) used[t] = 0;
    vi inv; for (int i = 0; i < N * M; ++ i) if (!used[i]) inv.pb(i + 1);
    return (M - Query(inv) == 1);
}

void Solve(int N, int M){
    vector <vi> ans(M);
    for (int i = 0; i < N * M; ++ i){
        int l = 1, r = M - 1, res = 0;
        while (l <= r){
            int mid = l + r >> 1;
            vi T = ans[mid]; T.pb(i);
            if (w(T, N, M)) res = mid, r = mid - 1;
            else l = mid + 1;
        }
        ans[res].pb(i);
    }
    for (int i = 0; i < M; ++ i) Answer(ans[i]);
}

//void solve(){
//
//}
//
//int main(){
//    if (fopen("pqh.inp", "r")){
//        freopen("pqh.inp", "r", stdin);
//        freopen("pqh.out", "w", stdout);
//    }
//    ios_base::sync_with_stdio(0);
//    cin.tie(0); cout.tie(0);
//
//    int t = 1; // cin >> t;
//    while (t --) solve();
//    return 0;
//}

Compilation message

dango3.cpp:19:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void maxl(auto &a, auto b) {a = max(a, b);}
      |           ^~~~
dango3.cpp:19:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void maxl(auto &a, auto b) {a = max(a, b);}
      |                    ^~~~
dango3.cpp:20:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   20 | void minl(auto &a, auto b) {a = min(a, b);}
      |           ^~~~
dango3.cpp:20:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   20 | void minl(auto &a, auto b) {a = min(a, b);}
      |                    ^~~~
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:34:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   34 |             int mid = l + r >> 1;
      |                       ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 348 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 560 ms 840 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2467 ms 740 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -