Submission #491276

# Submission time Handle Problem Language Result Execution time Memory
491276 2021-12-01T09:43:02 Z Sho10 Floppy (RMI20_floppy) C++17
28 / 100
87 ms 9232 KB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho
#include "floppy.h"
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define aint(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 998244353
#define PI 3.14159265359
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
map<ll,ll>viz;
void read_array(int subtask_id,const std::vector<int>&v){
ll mn=0;
vector<ll>compres;
for(auto it : v){
    compres.pb(it);
}
ll s1=0;
sort(compres.begin(),compres.end());
for(ll i=0;i<compres.size();i++)
{
    if(i==0||compres[i]!=compres[i-1]){
        viz[compres[i]]=++s1;
    }
}
vector<ll>a;
for(ll i=0;i<v.size();i++)
{
    a.pb(viz[v[i]]);
}
string bits="";
for(ll i=0;i<a.size();i++)
{
    ll x=a[i];
    for(ll j=0;j<14;j++)
    {
        if((1ll<<j)&x){
            bits+='1';
        }else bits+='0';
    }
}
save_to_floppy(bits);
}
std :: vector<int> solve_queries( int subtask_id ,int N, const std :: string &bits ,const std :: vector<int> &a ,const std :: vector<int> &b ){
vector<int>val;
ll m=bits.size()/14;
for(ll i=0;i<m;i++)
{
    ll nr=0;
    for(ll j=i*14;j<i*14+14;j++)
    {
        if(bits[j]=='1'){
            nr+=(1ll<<(j-i*14));
        }
    }
    val.pb(nr);
}
vector<int>ans;
for(ll i=0;i<a.size();i++)
{
    ll l=a[i],r=b[i];
    ll mx=0,pos=0;
    for(ll j=l;j<=r;j++)
    {
if(val[j]>mx){
    mx=val[j];
    pos=j;
}
    }
    ans.pb(pos);
}
return ans;
}
/*
int32_t main(){
CODE_START;
*/

Compilation message

floppy.cpp: In function 'void read_array(int, const std::vector<int>&)':
floppy.cpp:30:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 | for(ll i=0;i<compres.size();i++)
      |            ~^~~~~~~~~~~~~~~
floppy.cpp:37:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 | for(ll i=0;i<v.size();i++)
      |            ~^~~~~~~~~
floppy.cpp:42:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 | for(ll i=0;i<a.size();i++)
      |            ~^~~~~~~~~
floppy.cpp:23:4: warning: unused variable 'mn' [-Wunused-variable]
   23 | ll mn=0;
      |    ^~
floppy.cpp: In function 'std::vector<int> solve_queries(int, int, const string&, const std::vector<int>&, const std::vector<int>&)':
floppy.cpp:69:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 | for(ll i=0;i<a.size();i++)
      |            ~^~~~~~~~~
stub.cpp: In function 'void run2()':
stub.cpp:101:30: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  101 |     if (query_answers.size() != M) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 656 KB Output is correct
2 Correct 2 ms 652 KB Output is correct
3 Correct 2 ms 652 KB Output is correct
4 Correct 2 ms 652 KB Output is correct
5 Correct 2 ms 664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 4744 KB Output is correct
2 Correct 57 ms 4692 KB Output is correct
3 Correct 77 ms 4716 KB Output is correct
4 Correct 87 ms 4684 KB Output is correct
5 Correct 63 ms 4784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 9232 KB L is too large
2 Halted 0 ms 0 KB -