本地IDE通过(无警告),洛谷IDE炸了,C++5.11
查看原帖
本地IDE通过(无警告),洛谷IDE炸了,C++5.11
218752
smy2006楼主2022/3/18 17:19
#include<bits/stdc++.h>
using namespace std;

int n;
struct Station{
	double d,p;
}s[15];
bool got=false;
double d,v,c,ans=100000000;

void move(int stat,double cnt,double cost){
	if(stat>=n){
		got=true;ans=min(ans,cost);
		return;
	}
	int i=stat+1;
	while(s[stat].d+c*v>=s[i].d && i<=n){
		if(s[stat].p>s[i].p){
			if(cnt>=(s[i].d-s[stat].d)/v){ move(i,cnt-((s[i].d-s[stat].d)/v),cost);}
			else{ move(i,0,cost+s[stat].p*(((s[i].d-s[stat].d)/v)-cnt));}
		}else{
			move(i,c-(s[i].d-s[stat].d)/v,cost+(c-cnt)*s[stat].p);
		}
		i++;
	}
}

int main(){
	cin>>d>>c>>v;
	cin>>s[1].p;s[1].d=0;cin>>n;n+=2;
	s[n].d=d;s[n].p=-10; 
	for(int i=2; i<=n-1; i++){
		cin>>s[i].d>>s[i].p;
	}
	move(1,0,0);
	if(got==true){
		cout<<fixed<<setprecision(2)<<ans<<endl;
	}else{
		cout<<"No Solution"<<endl;
	}
} 

以下洛谷IDE编译信息

In file included from /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/char_traits.h:39,
                 from /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/ios:40,
                 from /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/istream:38,
                 from /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/sstream:38,
                 from /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/complex:45,
                 from /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/ccomplex:39,
                 from /nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/x86_64-unknown-linux-gnu/bits/stdc++.h:54,
                 from /tmp/compiler_5_c21roq/src:1:
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h: In instantiation of ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = int; _OI = double]’:
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h:522:42:   required from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = int; _OI = double]’
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h:530:31:   required from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = int; _OI = double]’
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h:652:38:   required from ‘_OI std::move(_II, _II, _OI) [with _II = int; _OI = double]’
/tmp/compiler_5_c21roq/src:20:14:   required from here
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h:488:64: 错误:no type named ‘iterator_category’ in ‘struct std::iterator_traits<int>’
  488 |       typedef typename iterator_traits<_II>::iterator_category _Category;
      |                                                                ^~~~~~~~~
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h:495:51: 错误:no type named ‘iterator_category’ in ‘struct std::iterator_traits<int>’
  494 |       return std::__copy_move<_IsMove, __memcpyable<_OI, _II>::__value,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  495 |                               _Category>::__copy_m(__first, __last, __result);
      |                               ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h: In instantiation of ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = true; _II = int; _OI = int]’:
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h:522:42:   required from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = true; _II = int; _OI = int]’
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h:530:31:   required from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = true; _II = int; _OI = int]’
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h:652:38:   required from ‘_OI std::move(_II, _II, _OI) [with _II = int; _OI = int]’
/tmp/compiler_5_c21roq/src:35:6:   required from here
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h:488:64: 错误:no type named ‘iterator_category’ in ‘struct std::iterator_traits<int>’
  488 |       typedef typename iterator_traits<_II>::iterator_category _Category;
      |                                                                ^~~~~~~~~
/nix/store/fdbr19mgwzmp1f17nbd9pqjv9vl9kzrq-luogu-gcc-11.2.0/include/c++/11.2.0/bits/stl_algobase.h:495:51: 错误:no type named ‘iterator_category’ in ‘struct std::iterator_traits<int>’
  494 |       return std::__copy_move<_IsMove, __memcpyable<_OI, _II>::__value,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  495 |                               _Category>::__copy_m(__first, __last, __result);
      |                               ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
2022/3/18 17:19
加载中...