Submission #598714

# Submission time Handle Problem Language Result Execution time Memory
598714 2022-07-18T19:11:59 Z MohammadAghil The Collection Game (BOI21_swaps) C++17
Compilation error
0 ms 0 KB
      #include <bits/stdc++.h>
      #include "swaps.h"
//   #pragma GCC optimize ("Ofast,unroll-loops")
// #pragma GCC target ("avx2")
    using namespace std;
  typedef long long ll;
   typedef pair<int, int> pp;
    #define er(args ...) cerr << __LINE__ << ": ", err(new istringstream(string(#args)), args), cerr << endl
      #define per(i,r,l) for(int i = (r); i >= (l); i--)
        #define rep(i,l,r) for(int i = (l); i < (r); i++)
           #define all(x) begin(x), end(x)
              #define sz(x) (int)(x).size()
                  #define pb push_back
                      #define ss second
                           #define ff first
                                   void err(istringstream *iss){}template<typename T,typename ...Args> void err(istringstream *iss,const T &_val, const Args&...args){string _name;*iss>>_name;if(_name.back()==',')_name.pop_back();cerr<<_name<<" = "<<_val<<", ",err(iss,args...);}
void IOS(){
     cin.tie(0) -> sync_with_stdio(0);
     #ifndef ONLINE_JUDGE
          freopen("in.in", "r", stdin);
          freopen("out.out", "w", stdout);
     #endif
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod = 1e9 + 7, maxn = 1e5 + 5, lg = 22, inf = ll(1e9) + 5;
ll pw(ll a,ll b,ll md=mod){if(!b)return 1;ll k=pw(a,b>>1ll);return k*k%md*(b&1ll?a:1)%md;}
 
void solve(int N, int V){
     vector<int> id(n); iota(all(id), 1);
     while(v--){
          for(int i = v&1; i < n-1; i += 2) schedule(id[i], id[i+1]);
          vector<int> res = visit();
          for(int i = v&1; i < n-1; i += 2) if(res[i>>1]^1) swap(id[i], id[i+1]);
     }
     answer(id);
}
 
// int main(){ IOS();
     
//      return 0; 
// }

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:29:21: error: 'n' was not declared in this scope
   29 |      vector<int> id(n); iota(all(id), 1);
      |                     ^
swaps.cpp:30:12: error: 'v' was not declared in this scope
   30 |      while(v--){
      |            ^
swaps.cpp: In function 'void IOS()':
swaps.cpp:20:18: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |           freopen("in.in", "r", stdin);
      |           ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
swaps.cpp:21:18: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |           freopen("out.out", "w", stdout);
      |           ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~