Submission #764176

#TimeUsernameProblemLanguageResultExecution timeMemory
764176vjudge1Exam (eJOI20_exam)C++17
Compilation error
0 ms0 KiB
// #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> #define len(x) (int)x.size() #define ull unsigned long long #define F first #define S second #define pb push_back #define pf push_front #define popb pop_back #define popf pop_front #define int long long using namespace std; using namespace __gnu_pbds; using ll = long long; const int N = 2e5 + 5; const int MOD = 1e9 + 7; int n,a[N],b[N],ans,c[N]; rec(int l = 0){ int cnt = 0; for (int i=1;i<=n;i++){ if (a[i]==b[i]) cnt++; } ans = max(ans, cnt); for (int i=l+1;i<=n;i++){ for (int j=i+1;j<=n;j++){ int mx = 0; for (int k=i;k<=j;k++){ mx = max(a[k],mx); } for (int k=i;k<=j;k++){ c[k] = a[k]; a[k] = mx; } rec(j + 1); for (int k=i;k<=j;k++){ a[k] = c[k]; } } } } main(){ // freopen("txt.in", "r", stdin); // freopen("txt.out", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i=1;i<=n;i++){ cin >> a[i]; } for (int i=1;i<=n;i++){ cin >> b[i]; } rec(); cout << ans; } //order_of_key(k): Number of items strictly smaller than k . //find_by_order(k): K-th element in a set (counting from zero). //sum of squares n*(n+1)*(2n+1)/6 //sum of cubes [n*(n+1)/2]^2 //sum of squares for odds n*(4*n*n-1)/3 //sum of cubes for odds n*n*(2*n*n-1) //a/b%mod = a*(b^(m-2)%mod) //(a>>x)&1 == 0 //a^b = (a+b)-2(a&b) //srand(time(0))-always changing

Compilation message (stderr)

exam.cpp:26:1: error: ISO C++ forbids declaration of 'rec' with no type [-fpermissive]
   26 | rec(int l = 0){
      | ^~~
exam.cpp: In function 'int rec(long long int)':
exam.cpp:48:1: warning: no return statement in function returning non-void [-Wreturn-type]
   48 | }
      | ^
exam.cpp: At global scope:
exam.cpp:50:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   50 | main(){
      | ^~~~