Submission #399325

# Submission time Handle Problem Language Result Execution time Memory
399325 2021-05-05T15:06:13 Z jeqcho Boat (APIO16_boat) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define fi first
#define se second

// subtask 1

int const N=5e2+3;
int a[N],b[N];
int const D=1e6+3;
ll dp[N][D];
ll mod =1e9+7;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n;
	cin>>n;
	set<int> st;
	F0R(i,n)
	{
		cin>>a[i]>>b[i];
		FOR(j,a[i],b[i]+1)
		{
			st.insert(j);
		}
	}
	vi v(all(st));
	map<int,int>mp;
	F0R(i,sz(st))
	{
		mp[v[i]]=i+1;
	}
	F0R(i,n)
	{
		a[i]=mp[a[i]];
		b[i]=mp[b[i]];
	}
	F0R(j,sz(st)+1)
	{
		dp[0][j]=0;
	}
	dp[0][0]=1;
	F0R(i,n)
	{
		F0R(j,n+1)
		{
			dp[i+1][j]=dp[i][j];
		}
		ll sum=0;
		F0R(j,b[i]+1)
		{
			if(j>=a[i])
			{
				dp[i+1][j]+=sum;
				dp[i+1][j]%=mod;
			}
			sum += dp[i][j];
			sum%=mod;
		}
	}
	ll ans=0;
	FOR(j,1,sz(st)+1)
	{
		ans+=dp[n][j];
		ans%=mod;
	}
	cout<<ans<<'\n';
	return 0;
}

Compilation message

/tmp/ccgjbbNP.o: In function `main':
boat.cpp:(.text.startup+0x38): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(globals_io.o)
boat.cpp:(.text.startup+0x3f): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(globals_io.o)
boat.cpp:(.text.startup+0x87): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccgjbbNP.o
boat.cpp:(.text.startup+0x8e): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccgjbbNP.o
boat.cpp:(.text.startup+0x9e): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(globals_io.o)
boat.cpp:(.text.startup+0x328): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccgjbbNP.o
boat.cpp:(.text.startup+0x32f): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccgjbbNP.o
boat.cpp:(.text.startup+0x4b8): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccgjbbNP.o
boat.cpp:(.text.startup+0x4c8): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccgjbbNP.o
boat.cpp:(.text.startup+0x5ea): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(globals_io.o)
/tmp/ccgjbbNP.o: In function `_GLOBAL__sub_I_a':
boat.cpp:(.text.startup+0x6b7): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status