Submission #746914

#TimeUsernameProblemLanguageResultExecution timeMemory
746914anusha777A Difficult(y) Choice (BOI21_books)C++14
Compilation error
0 ms0 KiB
#include "books.h" #include <bits/stdc++.h> #define fast ios::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL) #define sz(x) (int)((x).size()) #define pb push_back #define vi vector<int> #define vb vector<bool> #define vvb vector<vb> #define pi pair<int,int> #define vpi vector<pi> #define vvi vector<vi> #define vc vector<char> #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define pbb() pop_back() #define f first //#define s second #define ll long long //#define int long long #define ull unsigned long long #define forr(i, a, b) for(int i=a; i<b; i++) const int N=120000+1, mod=1e9 + 9, inf=1e27+1; using namespace std; //vi dx= { 0, 1, 0 , -1} , dy= {-1,0, 1, 0}; void solve2(int n, int k, ll a , int s) { vector<ull> p(n+1); pi last={inf. -1}; forr(i, 1, n+1) { int t=skim(i); p[i]= p[i-1] + t; if(t>=a and last.f==inf) last={t,i}; } forr(i, k, n+1) if(p[i]-p[i-k]>=a and p[i]-p[i-k]<=2ull*a) { vi v; forr(j, i-k+1, i+1) v.pb(j); answer(v); } if(last.f + p[k-1]<=2ull and p[k-1]<a) { vi v; forr(i, 1, k) v.pb(i); v.pb(last.s); answer(v); } } impossible(); void solve(int n, int k, ll a , int s) { if(n==s) solve2(n, k,a ,s); } //signed main() //{ // fast; // int t; // t=1; // //cin>>t; // while(t--) task(); //}

Compilation message (stderr)

books.cpp:22:44: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+27' to '2147483647' [-Woverflow]
   22 | const int N=120000+1, mod=1e9 + 9, inf=1e27+1;
      |                                        ~~~~^~
books.cpp: In function 'void solve2(int, int, long long int, int)':
books.cpp:28:19: error: expected unqualified-id before '-' token
   28 |     pi last={inf. -1};
      |                   ^
books.cpp:28:21: error: could not convert '{<expression error>}' from '<brace-enclosed initializer list>' to 'std::pair<int, int>'
   28 |     pi last={inf. -1};
      |                     ^
      |                     |
      |                     <brace-enclosed initializer list>
books.cpp:35:35: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<long long unsigned int>, long long unsigned int>::value_type' {aka 'long long unsigned int'} and 'long long int' [-Wsign-compare]
   35 |     forr(i, k, n+1) if(p[i]-p[i-k]>=a and p[i]-p[i-k]<=2ull*a)
books.cpp:41:40: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<long long unsigned int>, long long unsigned int>::value_type' {aka 'long long unsigned int'} and 'long long int' [-Wsign-compare]
   41 |     if(last.f + p[k-1]<=2ull and p[k-1]<a)
books.cpp:45:19: error: 'struct std::pair<int, int>' has no member named 's'
   45 |         v.pb(last.s);
      |                   ^
books.cpp: At global scope:
books.cpp:48:18: error: expected constructor, destructor, or type conversion before ';' token
   48 | }    impossible();
      |                  ^