답안 #980020

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980020 2024-05-11T19:20:49 Z vjudge1 가장 긴 여행 (IOI23_longesttrip) C++17
0 / 100
1 ms 344 KB
// hola soy Dember :D
// 31/03/2024

#include "longesttrip.h"
#include <bits/stdc++.h>

#define ll int 
#define pll pair<ll,ll>
#define F first
#define S second 
#define Z size()
#define pb push_back
#define bp pop_back
#define fo(x,y,z) for(ll x=y; x<=z; x++)
#define of(x,y,z) for(ll x=y; x>=z; x--)
#define all(n) n.begin(), n.end()
#define arr(x,y,z) x+y, x+y+z

using namespace std;

void value(ll in){cout<<((in)?"YES\n":"NO\n");}

const ll N=2e5+5, M=3e3+5, mod=998244353, md=1e9+7, inf=1e18;

ll n, k, xd, zd;

vector<ll> a(1,0),b, ans;
pair<vector<ll>, vector<ll>> c1, c2;

/*bool are_connected(vector<ll> x, vector<ll> y){
    cout<<"a "; for(auto u:x)cout<<u<<' '; cout<<"\n";
    cout<<"b "; for(auto u:y)cout<<u<<' '; cout<<"\n";
    bool sp;
    cin>>sp;
    return sp;
}*/

vector<int> longest_trip(int N, int D){
    n=N; k=D;
	
	fo(i,1,n){
		while(!b.empty()){
			c2.F.pb(a.back());
			c2.S.pb(b.back());
			
			if(are_connected(c2.F,c2.S))
				while(!b.empty()){a.pb(b.back());b.bp();}
		}
		
		c1.F.pb(a.back());
		c1.S.pb(i);
		
		if(are_connected(c1.F,c1.S))a.pb(i);
		else b.pb(i);
	}
	
	ans=((a.size()>b.size())?a:b);
	
	return ans;
}

/*int main()
{
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
    
    int t=1, m; 
    cin>>t>>m;
    
    vector<ll> v=longest_trip(t,m);
    
    for(auto u:v)cout<<u<<' ';cout<<"\n";

    return 0;
}*/

Compilation message

longesttrip.cpp:23:57: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   23 | const ll N=2e5+5, M=3e3+5, mod=998244353, md=1e9+7, inf=1e18;
      |                                                         ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB non-disjoint arrays
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB invalid array
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB invalid array
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB invalid array
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB invalid array
2 Halted 0 ms 0 KB -