Submission #730153

# Submission time Handle Problem Language Result Execution time Memory
730153 2023-04-25T10:58:49 Z ktkerem Roller Coaster Railroad (IOI16_railroad) C++17
Compilation error
0 ms 0 KB
/*#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef __int128 vll;
typedef long long ftyp;
typedef std::complex<ftyp> vec;
#define llll std::pair<ll , ll>
#define pb push_back
#define fi first
#define sec second
#define cx real
#define cy imag
#define all(a) a.begin() , a.end()
#define debug std::cout << "!!ALERT ALERT!!" << std::endl;  
const ll limit = 1e12+7;
const ll sus = 1e5+5;
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
int find_subset(int l , int u , int w[] , int n , int res[]){
  ll ps = 0 , ss = 0;;
  ll lf = n - 1;
  std::sort(w , w+n);
  while(l > ss && lf >= 0){
    ss += w[lf];
    lf--;
  }
  lf++;
  ll rg = 0;
  if(lf == 0 && l > ss){
    return 0;
  }
  if(ss <= u && ss >= l){
    ll o = 0;
    for(ll i = n-1;lf <= i;i--){
      res[o] = w[i];
      o++;
    }
    return o;
  }
  for(ll i = 1;n>=i;i++){
    if(i != 0){
      ps += w[i-1];
    }
    while(lf < i){
      ss -= w[lf];
      lf--;
    }
    while(ps + ss > u && lf < n){
      ss -= w[lf];
      lf++;
    }
    if(ps + ss >= l && ps + ss <= u){
      ll o = 0;
      for(ll i = n-1;lf <= i;i--){
        res[o] = w[i];
        o++;
      }
      for(ll j = 0;i>j;j++){
        res[o] = w[j];
        o++;
      }
      return o;
    }
  }
  return 0;
}
/*void solve(){
  int res[250];
  int ar[] = {15 , 17 , 16 , 18};
  ll ans = find_subset(10 , 20 , ar , 4 , res);
  std::cout << res[0] << "\n";
  return;
}
int main(){
  std::ios_base::sync_with_stdio(false);std::cin.tie(NULL);
  #ifndef ONLINE_JUDGE
    freopen("in.txt" , "r" , stdin);
    freopen("out.txt" , "w" , stdout);
  #endif
  ll t = 1;
  //std::cin >> t;
  while(t--){
    solve();
  }
}*/

Compilation message

railroad.cpp:5:78: warning: "/*" within comment [-Wcomment]
    5 | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")/**/
      |                                                                               
railroad.cpp: In function 'int find_subset(int, int, int*, int, int*)':
railroad.cpp:32:6: warning: unused variable 'rg' [-Wunused-variable]
   32 |   ll rg = 0;
      |      ^~
/usr/bin/ld: /tmp/cc8UwPgZ.o: in function `main':
grader.cpp:(.text.startup+0xf4): undefined reference to `plan_roller_coaster(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status