제출 #1072201

#제출 시각아이디문제언어결과실행 시간메모리
1072201vjudge1건물 4 (JOI20_building4)C++17
컴파일 에러
0 ms0 KiB
/*Template by : Melag & Megu*/ #include <bits/stdc++.h> using namespace std; /*Pragma*/ //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") //#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") //#pragma GCC target("sse,sse2,ssse3,sse4,abm,mmx,avx,fma") /*Global Shortcut*/ //#define int long long #define nl "\n" //#define endl "\n" #define fl flush /*Shortcut*/ #define p(type1,type2) pair<type1,type2> #define vc(type) vector<type> #define PQ(type) priority_queue<type> #define PQ2(type) priority_queue<type, vector<type>, greater<type>> #define ft first #define sc second #define ts(val) to_string(val) #define ti(val) stoi(val) /*Contaiiner Shortcut*/ #define mmst(array,value) memset(array,value,sizeof(array)) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() #define Pb push_back #define pB pop_back #define mp make_pair #define lb lower_bound #define ub upper_bound /*Typedeff Re-define*/ typedef unsigned long long ull; typedef long double ld; typedef long long ll; typedef char ch; typedef string str; /*Decimal*/ #define decimal(value) cout << fixed << setprecision(value); /*Constant*/ const int N = 5e5 + 1e1 + 10; const ll MOD = 998244353; const ll mod = 1e9 + 7; const ll inf = 2e18 + 20; const ld eps = 1e-9; /*Traversal Moving*/ //int dx[] = {-1,1,0,0}; //int dy[] = {0,0,-1,1}; //str dz[] = {"U","D","L","R"}; /*-------------------------------------------------------------------------------------------------------*/ int a[N], b[N]; int dp[2*N][N]; str DP[2*N][N]; bool f(int idx, int cnt1, int cnt2, int last, int &n){ if(idx==2*n) return true; if(dp[idx][cnt1] != -1) return dp[idx][cnt1]; bool p,q,r,s; p=q=r=s=0; if(cnt1 < n) { if(a[idx] >= last) {p = f(idx+1, cnt1+1, cnt2, a[idx], n);} if(b[idx] >= last and cnt2 < n) q = f(idx+1, cnt1, cnt2+1, b[idx], n); } if(cnt2 < n) { if(a[idx] >= last and cnt1 < n) r = f(idx+1, cnt1+1, cnt2, a[idx], n); if(b[idx] >= last) s = f(idx+1, cnt1, cnt2+1, b[idx], n); } return dp[idx][cnt1] = p or q or r or s; } void solve() { mmst(dp,-1); int n; cin >> n; for(int i=0;i<2*n;i++) cin >> a[i]; for(int i=0;i<2*n;i++) cin >> b[i]; //cout << ((f(0,0,0,0,n)) ? "YES" : "NO") << nl; bool valid = f(0,0,0,0,n); if(!valid) cout << "-1 \n"; else{ } return; } int32_t main(int32_t argc, char *argv[]) { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); int t=1; //cin >> t; while(t-- > 0) solve(); return 0; }

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

building4.cpp: In function 'bool f(int, int, int, int, int&)':
building4.cpp:77:26: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   77 |     return dp[idx][cnt1] = p or q or r or s;
      |            ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status