답안 #551461

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
551461 2022-04-20T18:59:15 Z inksamurai Super Dango Maker (JOI22_dango3) C++17
100 / 100
2424 ms 1896 KB
#include <bits/stdc++.h>
#include "dango3.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rng(i,x,n) for(int i=x;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define vec(...) vector<__VA_ARGS__>
#define _3xxEYjy ios::sync_with_stdio(0),cin.tie(0)
typedef long long ll;
using pii=pair<int,int>;
using vi=vector<int>;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}
// e

void Solve(int n,int m){
	vi ids;
	vec(vi) wt(m);
	rep(i,n*m){
		ids.pb(i+1);
		rep(j,m)wt[j].pb(i+1);
	}
	vec(vi) pns(m);
	vi usd(n*m);

	auto ask=[&](int id,int x){
		wt[id].erase(wt[id].begin()+x-sz(pns[id])-1);
		int res=Query(wt[id]);
		wt[id].insert(wt[id].begin()+x-sz(pns[id])-1,x);
		return res;
	};

	// print(res);
	for(int i=0;i<n*m;i++){
		int _l=0,_r=m-1;
		int _c=0;
		while(_l<=_r){
			int _m=(_l+_r)/2;
			if(ask(_m,i+1)==m-2){
				_c=_m+1,_l=_m+1;
			}else{
				_r=_m-1;
			}
		}
		wt[_c].erase(wt[_c].begin()+i-sz(pns[_c]));
		pns[_c].pb(i+1);
	}
	for(auto vc:pns){
		Answer(vc);
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 340 KB Output is correct
2 Correct 18 ms 424 KB Output is correct
3 Correct 19 ms 424 KB Output is correct
4 Correct 18 ms 428 KB Output is correct
5 Correct 13 ms 428 KB Output is correct
6 Correct 18 ms 424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 599 ms 1168 KB Output is correct
2 Correct 586 ms 1108 KB Output is correct
3 Correct 606 ms 1228 KB Output is correct
4 Correct 601 ms 1180 KB Output is correct
5 Correct 588 ms 1160 KB Output is correct
6 Correct 605 ms 1160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2334 ms 1852 KB Output is correct
2 Correct 2332 ms 1896 KB Output is correct
3 Correct 2424 ms 1888 KB Output is correct
4 Correct 2396 ms 1892 KB Output is correct
5 Correct 2312 ms 1892 KB Output is correct
6 Correct 2347 ms 1896 KB Output is correct