QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#336086#8284. Cats and Fishucup-team133#WA 0ms3840kbC++172.6kb2024-02-24 13:10:282024-02-24 13:10:28

Judging History

This is the latest submission verdict.

  • [2024-02-24 13:10:28]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3840kb
  • [2024-02-24 13:10:28]
  • Submitted

answer

// -fsanitize=undefined,
//#define _GLIBCXX_DEBUG


#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <random>
#include <stdio.h>
#include <fstream>
#include <functional>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <chrono>




using namespace std;




#define rep(i,n) for (int i=0;i<n;i+=1)
#define rrep(i,n) for (int i=n-1;i>-1;i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()

#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << " )\n";

template<class T>
using vec = vector<T>;
template<class T>
using vvec = vec<vec<T>>;
template<class T>
using vvvec = vec<vvec<T>>;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;


template<class T>
bool chmin(T &a, T b){
  if (a>b){
    a = b;
    return true;
  }
  return false;
}

template<class T>
bool chmax(T &a, T b){
  if (a<b){
    a = b;
    return true;
  }
  return false;
}

template<class T>
T sum(vec<T> x){
  T res=0;
  for (auto e:x){
    res += e;
  }
  return res;
}

template<class T>
void printv(vec<T> x){
  for (auto e:x){
    cout<<e<<" ";
  }
  cout<<endl;
}



template<class T,class U>
ostream& operator<<(ostream& os, const pair<T,U>& A){
  os << "(" << A.first <<", " << A.second << ")";
  return os;
}

template<class T>
ostream& operator<<(ostream& os, const set<T>& S){
  os << "set{";
  for (auto a:S){
    os << a;
    auto it = S.find(a);
    it++;
    if (it!=S.end()){
      os << ", ";
    }
  }
  os << "}";
  return os;
}

template<class T>
ostream& operator<<(ostream& os, const vec<T>& A){
  os << "[";
  rep(i,A.size()){
    os << A[i];
    if (i!=A.size()-1){
      os << ", ";
    }
  }
  os << "]" ;
  return os;
}




void solve(){
  int m,n,x;
  cin>>m>>n>>x;
  vec<int> c(n);
  rep(i,n) cin>>c[i];

  priority_queue<pair<int,int>> pq;
  rep(i,n){
    pq.push({0,-c[i]});
  }

  int p = m,q = 0;
  while (!pq.empty()){
    auto [t,c] = pq.top(); pq.pop();
    t = -t, c = -c;
    if (t!=0){
      q--;
    }
    if (x <= t){
      break;
    }
    if (p!=0){
      p--;
      q++;
      pq.push({-t-c,-c});
    }
  }

  cout << p << " " << q << "\n";




  


}

  
  







int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  
  int T = 1;
  //cin>>T;
  while (T--){
    solve();
  }

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3804kb

input:

2 1 1
1

output:

1 0

result:

ok 2 number(s): "1 0"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

8 3 5
1 3 4

output:

0 1

result:

ok 2 number(s): "0 1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

4 5 1
5 4 3 2 1

output:

0 3

result:

ok 2 number(s): "0 3"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

1 1 10
1

output:

0 0

result:

ok 2 number(s): "0 0"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

14 3 10
1 40 50

output:

2 2

result:

ok 2 number(s): "2 2"

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3840kb

input:

8 2 7
12 13

output:

6 1

result:

wrong answer 2nd numbers differ - expected: '2', found: '1'