Submission #772654

#TimeUsernameProblemLanguageResultExecution timeMemory
772654I_Love_EliskaM_Seats (IOI18_seats)C++14
Compilation error
0 ms0 KiB
// Esti <3 //\ šťastia pre nás :) // you're already the best // _ // ^ ^ // // >(O_O)<___// // \ __ __ \ // \\ \\ \\\\ #include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("O3","unroll-loops") //#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #pragma GCC optimize("O3") #pragma GCC target("popcnt") using ll = long long; #define int long long #define forn(i,n) for(int i=0; i<(n); ++i) #define pb push_back #define pi pair<int,int> #define f first #define s second #define vii(a,n) vector<int> a(n); forn(i,n) cin>>a[i]; #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); const int inf = 1e18; const int mod = 1e9+7;//998244353; // \ \ :smiling_face_with_3_hearts: :smiling_face_with_3_hearts: :smiling_face_with_3_hearts: //vidime sa veľmi skoro, moje slnko void p2(vector<int>&a, vector<int>&b, int n) { vector<int> vis(n,0); int ans=0; forn(i,n) { if (vis[i]) continue; if (a[i]!=b[i]) continue; ++ans; for (int l=i-1; l>=0; --l) { if (a[l]>b[l]) break; ++ans; } for (int r=i+1; r<n; ++r) { if (a[r]>b[r]) break; ++ans; vis[r]=1; } } cout<<ans<<'\n'; exit(0); } const int N=5555; int dp[N][N]; void p3(vector<int> a, vector<int> b, int n) { forn(i,n) { int mx=0; forn(j,i) mx=max(mx,dp[i][j]); for (int j=i; j<n; ++j) { mx=max(mx,dp[i][j]); dp[i+1][j]=max(dp[i+1][j],mx+(b[i]==a[j])); } } cout<<dp[n][n-1]<<'\n'; exit(0); } void solve() { int n; cin>>n; vii(a,n); vii(b,n); int z=1; forn(i,n) z&=b[i]==b[0]; if (z) p2(a,b,n); z=n<=5000; forn(i,n-1) z&=a[i]<a[i+1]; if (z) p3(a,b,n); } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; //cin>>t; while (t--) solve(); return 0; }

Compilation message (stderr)

seats.cpp:3:1: warning: multi-line comment [-Wcomment]
    3 | //\
      | ^
seats.cpp:9:1: warning: multi-line comment [-Wcomment]
    9 | //   \ __ __  \
      | ^
seats.cpp:36:1: warning: multi-line comment [-Wcomment]
   36 | // \
      | ^
/usr/bin/ld: /tmp/ccHdLMp1.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccqhp1y1.o:seats.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccHdLMp1.o: in function `main':
grader.cpp:(.text.startup+0x22f): undefined reference to `give_initial_chart(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader.cpp:(.text.startup+0x2ae): undefined reference to `swap_seats(int, int)'
collect2: error: ld returned 1 exit status