Submission #1218080

#TimeUsernameProblemLanguageResultExecution timeMemory
1218080thdh__Super Dango Maker (JOI22_dango3)C++20
Compilation error
0 ms0 KiB
#include "dango3.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define eb emplace_back
#define pu push
#define ins insert
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define bruh ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fu(x,a,b) for (auto x=a;x<=b;x++)
#define fd(x,a,b) for (auto x=a;x>=b;x--)
#define int ll

using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());

/*
Competitive Programming notes that I need to study & fix my dumbass self:

1. Coding:
- Always be sure to check the memory of arrays (maybe use vectors), for loops, I don't know
- Always try to maximize the memory if possible, even if you are going for subtasks
- Do not exploit #define int long long, it will kill you

2. Stress:
- Don't be cocky and think stressing with your dumbass brute-force solution will give you guaranteed AC. 
- Always try generating big testcases and try if they run

3. Time management:
- Don't overcommit or undercommit, always spend a certain amount of time to think a problem, don't just look at it and say I'm fucked
- Do not spend too much time coding brute-force solutions, they should be easily-codable solutions that don't take up too much time

I hate offline because I am dumb
*/

typedef pair<int, int> ii;
const int N = 2e5+5;
const int mod = 1e9+7;
const int inf = 1e18;
using cd = complex<double>;
const long double PI = acos(-1);
int power(int a,int b) {ll x = 1;if (a >= mod) a%=mod; while (b) {if (b & 1) x = x*a % mod;a = a*a % mod;b>>=1;}return x;} 


void Solve(int N, int M)
{
	int n = N,m = M;	
	vector<bool> used(N*M+1);
	vector<vector<int>> g(M+1);
	for (int i = 1; i <= n*m; i++) 
	{
		int l = 1, r = m, res = 1;
		while (l <= r) 
		{
			int mid = l+r>>1;
			for (int j = 1; j <= n*m; j++) used[j] = 0;
			used[i] = 1;
			for (int j = 1; j <= mid; j++) for (auto k : g[j]) used[k] = 1;
			vector<int> q;
			for (int j = 1; j <= n*m; j++) if (!used[j]) q.pb(j);
			if (Query(q) == m-mid) res = mid, l = mid+1;
			else r = mid-1;
		}
		g[res].pb(i);
	}
	for (int i = 1; i <= m; i++) Answer(g[i]);
}

Compilation message (stderr)

dango3.cpp: In function 'void Solve(long long int, long long int)':
dango3.cpp:65:35: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long long int>'
   65 |                         if (Query(q) == m-mid) res = mid, l = mid+1;
      |                                   ^
In file included from dango3.cpp:1:
dango3.h:5:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    5 | int Query(const std::vector<int> &x);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^
dango3.cpp:70:44: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'}
   70 |         for (int i = 1; i <= m; i++) Answer(g[i]);
      |                                      ~~~~~~^~~~~~
In file included from dango3.cpp:1:
dango3.h:6:37: note: in passing argument 1 of 'void Answer(const std::vector<int>&)'
    6 | void Answer(const std::vector<int> &a);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^