// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#include "grader.h"
#ifdef ULVI
#include "debug.hpp"
#else
#define db(...)
#define dbv(v)
#define line()
#endif
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ff first
#define ss second
#define enld endl
using namespace std;
using namespace __gnu_pbds;
typedef int ll;
typedef pair<ll,ll> pll;
const ll sz=2e5+100;
const ll lg=20;
const ll mod=1e9+7;
const ll inf=1e18;
template<class T>
using indexed_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
vector < int > findSequence (int n)
{
vector < int > ans (n, 0);
ll cnt0=0,cnt1=0;
for(ll i=1;i<=n;i++){
vector<ll> a(i,0),b(i,1);
if(!isSubsequence(a)){
cnt0=i-1;
cnt1=n-i+1;
break;
}
if(!isSubsequence(b)){
cnt1=i-1;
cnt0=n-i+1;
}
}
ll cur0=0,cur1=0;
for(ll i=0;i<n;i++){
vector<ll> v;
if(cur0-cur1+cnt1+1<n/2+1){
for(ll j=0;j<cnt0+1;j++) v.push_back(0);
for(ll j=0;j<cnt1-cur1;j++) v.push_back(1);
if(isSubsequence(v)){
cnt0++;
ans[i]=0;
}
else{
cnt1++;
ans[i]=1;
}
}
else{
for(ll j=0;j<cnt1+1;j++) v.push_back(0);
for(ll j=0;j<cnt0-cur0;j++) v.push_back(1);
if(isSubsequence(v)){
cnt1++;
ans[i]=0;
}
else{
cnt0++;
ans[i]=1;
}
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
hidden.cpp:26:14: warning: overflow in conversion from 'double' to 'll' {aka 'int'} changes value from '1.0e+18' to '2147483647' [-Woverflow]
26 | const ll inf=1e18;
| ^~~~
grader.cpp: In function 'int main()':
grader.cpp:28:26: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
28 | fprintf (fifo_out, "%d\n", ans.size ());
| ~^ ~~~~~~~~~~~
| | |
| int std::vector<int>::size_type {aka long unsigned int}
| %ld| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |