답안 #892531

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
892531 2023-12-25T13:16:03 Z vjudge1 Super Dango Maker (JOI22_dango3) C++17
100 / 100
258 ms 1104 KB
#include <bits/stdc++.h>
#include "dango3.h"
#define ll int
#define str string
#define ins insert
#define ld long double
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define fr first
#define sc second
#define mpa make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define sz size()
#define bc back()
#define ar array
#define vll vector<ll> 
using namespace std;/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;*/
template <class _T>
bool chmin(_T &x, const _T &y){
    if(x>y){
        x=y;
        return true;
    }
    return false;
}
template <class _T>
bool chmax(_T &x, const _T &y){
    bool flag=false;
    if (x<y){
        x=y;flag|=true;
    }
    return flag;
}
//#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
void start(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
const ll mod=1e9+7;
const ld eps=1e-9;
void rec(vll v,ll m){
	ll i,n=v.sz;
	if(m==1){
		Answer(v);
		return;
	}
	vll nv;
	for(i=0;i<n;i++){
		nv.pb(v[0]);
		v.erase(v.begin());
		ll x=Query(v);
		if(x<m/2){
			v.pb(nv.bc);
			nv.pob;
		}
	}
	rec(v,m/2);
	rec(nv,m-m/2);
}
void Solve(ll n,ll m){
	vll v(n*m);
	iota(all(v),1);
	rec(v,m);
}	
/*
1
7
1 2
2 3
3 4
4 5
3 6
6 7
2
4 1
5 7






*/

Compilation message

dango3.cpp: In function 'void fre(std::string)':
dango3.cpp:44:27: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 | void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
      |                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dango3.cpp:44:64: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 | void fre(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);}
      |                                                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 596 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 556 KB Output is correct
2 Correct 59 ms 592 KB Output is correct
3 Correct 66 ms 604 KB Output is correct
4 Correct 75 ms 580 KB Output is correct
5 Correct 50 ms 576 KB Output is correct
6 Correct 48 ms 580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 191 ms 600 KB Output is correct
2 Correct 190 ms 680 KB Output is correct
3 Correct 257 ms 600 KB Output is correct
4 Correct 258 ms 720 KB Output is correct
5 Correct 238 ms 1104 KB Output is correct
6 Correct 190 ms 604 KB Output is correct