제출 #266878

#제출 시각아이디문제언어결과실행 시간메모리
266878youssefbou62Linear Garden (IOI08_linear_garden)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") using namespace std; #define mp make_pair #define fi first #define se second #define all(v) v.begin(),v.end() #define allarr(a) a , a + n #define ll long long #define pb push_back #define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL) #define sz(x) (int)x.size() typedef pair<int, int> pi; typedef pair<ll,ll> pll ; typedef pair<int,pi> trp ; typedef vector<pi> vpi; typedef priority_queue< pi, vector <pi> , greater<pi> > spq; const int MAXN = 1e6+5 ; int dp[MAXN][2][7][7][7]; int N ; int M ; string s; void add(int& x ,int y ){ x = ( x % M + y % M ) % M ; } void solve (){ vector<int> S ; for(int i = 0 ; i < N ; i++ )S.pb(s[i]=='P'); dp[0][0][2][2][2] = 1 ; for(int i = 0 ; i < N ; i++ ){ for(int pref = -2 ; pref <= 2 ; pref++ ) for(int hpref = -2 ; hpref <= 2 ; hpref++ ) for(int lpref = -2 ; lpref <= 2 ; lpref++ ){ for(int choice : {0,1}){ int nxt_pref = pref ; if( choice )nxt_pref++;else nxt_pref--; int x = min(nxt_pref,lpref) ; int y= max(nxt_pref,hpref); if( abs(hpref-lpref) > 2 || nxt_pref==3 || nxt_pref==-3||x == -3 || y == 3 || y == -3 || x == 3 )continue ; if(choice < S[i]) add(dp[i+1][1][3+nxt_pref][3+x][3+y],dp[i][0][pref+3][lpref+3][hpref+3]); if(choice == S[i]) add(dp[i+1][0][3+nxt_pref][3+x][3+y],dp[i][0][pref+3][lpref+2][hpref+3]); add(dp[i+1][1][3+nxt_pref][3+x][3+y],dp[i][1][pref+3][lpref+3][hpref+3]); } // if(dp[i][1][pref][lpref][hpref]) // cout << i << " " << pref << " " <<lpref << " " <<hpref<<endl; } } int ans = 1 ; for(int pref = -2 ; pref <= 2 ; pref++ ) for(int hpref = -2 ; hpref <= 2 ; hpref++ ) for(int lpref = -2 ; lpref <= 2 ; lpref++) if( abs(hpref-lpref) <= 2 ) add(ans,dp[N][1][pref+3][lpref+3][hpref+3]); cout << ans << endl; } int main(){ // ifstream cin("in.in"); cin >> N >> M >> s ; solve() ; }

컴파일 시 표준 에러 (stderr) 메시지

/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(vterminate.o): In function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x1a): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(vterminate.o): In function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x27): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(ios_init.o): In function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x19): relocation truncated to fit: R_X86_64_32S against symbol `std::ios_base::Init::_S_refcount' defined in .bss._ZNSt8ios_base4Init11_S_refcountE section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(ios.o)
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(ios_init.o): In function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x59): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(globals_io.o)
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(ios_init.o): In function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x60): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(globals_io.o)
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(ios_init.o): In function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x6b): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(globals_io.o)
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(ios_init.o): In function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(globals_io.o)
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(ios_init.o): In function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x8b): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(globals_io.o)
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(ios_init.o): In function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0xa0): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(globals_io.o)
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(ios_init.o): In function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0xab): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(globals_io.o)
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.a(ios_init.o): In function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0xba): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status