QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#417873 | #8723. 乘二 | DeNeRATe | Compile Error | / | / | C++11 | 1.7kb | 2024-05-23 00:01:53 | 2024-05-23 00:01:54 |
Judging History
answer
#include <bits/stdc++.h>
#define mod (ll)(1e9 + 7)
#define lson (x << 1)
#define rson (x << 1 | 1)
#define ll long long
#define INF 0x3f3f3f3f
#define vi vector<int>
#define ep emplace_back
#define pii pair<int, int>
#define cl(x, y) memset(x, y, sizeof(x))
#define de(x) cerr << #x << " = " << x << " " << endl
#define rep(i, a, b) for(ll i = a; i <= b; i++)
#define per(i, a, b) for(ll i = a; i >= b; i--)
#define LOCAL_TEST freopen("stdout.txt", "w", stdout)
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define MULTI_TEST int _;cin>>_;while(_--)CLEAN(),PROBLEM()
using namespace std;
const int maxn = 5e3 + 5;
inline ll fast(ll a, ll b) {
ll res = 1;
while(b) {
if(b & 1) res = (res * a) % mod;
a = (a * a) % mod;
b >>= 1;
}
return res;
}
inline void CLEAN() {
}
inline void PROBLEM() {
ll n, k;
cin >> n >> k;
vector<ll> arr(n + 1);
vector<ll> bit(n + 1, 0);
ll cnt = 0, Max = 0;
rep(i, 1, n) {
cin >> arr[i];
per(j, 32, 0) {
if((arr[i] >> j) & 1) {
bit[i] = j;
Max = max(Max, bit[i]);
break;
}
}
}
rep(i, 1, n)
cnt += Max - bit[i];
ll ans = 0;
priority_queue<ll, vector<ll>, greater<> > mine;
rep(i, 1, n) mine.push(arr[i]);
ll lim = min(k, cnt);
while(lim--) {
ll now = mine.top();
mine.pop();
now *= 2ll;
mine.push(now);
}
if(cnt >= k) {
rep(i, 1, n) ans = (ans + mine.top() % mod) % mod, mine.pop();
} else {
k -= cnt;
ll all = k / n, remain = k % n;
rep(i, 1, n) {
ans = (ans + mine.top() % mod * fast(2ll, all + (i <= remain)) % mod) % mod;
mine.pop();
}
}
cout << ans << endl;
}
int main() {
IOS;
// MULTI_TEST;
PROBLEM();
system("pause");
return 0;
}
Details
answer.code: In function ‘void PROBLEM()’: answer.code:56:48: error: wrong number of template arguments (0, should be 1) 56 | priority_queue<ll, vector<ll>, greater<> > mine; | ^ In file included from /usr/include/c++/13/string:49, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from answer.code:1: /usr/include/c++/13/bits/stl_function.h:393:12: note: provided for ‘template<class _Tp> struct std::greater’ 393 | struct greater : public binary_function<_Tp, _Tp, bool> | ^~~~~~~ answer.code:56:50: error: template argument 3 is invalid 56 | priority_queue<ll, vector<ll>, greater<> > mine; | ^ answer.code:57:27: error: request for member ‘push’ in ‘mine’, which is of non-class type ‘int’ 57 | rep(i, 1, n) mine.push(arr[i]); | ^~~~ answer.code:60:31: error: request for member ‘top’ in ‘mine’, which is of non-class type ‘int’ 60 | ll now = mine.top(); | ^~~ answer.code:61:22: error: request for member ‘pop’ in ‘mine’, which is of non-class type ‘int’ 61 | mine.pop(); | ^~~ answer.code:63:22: error: request for member ‘push’ in ‘mine’, which is of non-class type ‘int’ 63 | mine.push(now); | ^~~~ answer.code:66:48: error: request for member ‘top’ in ‘mine’, which is of non-class type ‘int’ 66 | rep(i, 1, n) ans = (ans + mine.top() % mod) % mod, mine.pop(); | ^~~ answer.code:66:73: error: request for member ‘pop’ in ‘mine’, which is of non-class type ‘int’ 66 | rep(i, 1, n) ans = (ans + mine.top() % mod) % mod, mine.pop(); | ^~~ answer.code:71:43: error: request for member ‘top’ in ‘mine’, which is of non-class type ‘int’ 71 | ans = (ans + mine.top() % mod * fast(2ll, all + (i <= remain)) % mod) % mod; | ^~~ answer.code:72:30: error: request for member ‘pop’ in ‘mine’, which is of non-class type ‘int’ 72 | mine.pop(); | ^~~ answer.code: In function ‘int main()’: answer.code:84:15: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 84 | system("pause"); | ~~~~~~^~~~~~~~~