QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#418111 | #8723. 乘二 | ehdxbc | Compile Error | / | / | C++20 | 1.8kb | 2024-05-23 10:50:16 | 2024-05-23 10:50:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define PII pair<int, int>
const int N = 1e5+10;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
int gcd(int x,int y){
return y ? gcd(y, x % y) : x;
}
const int mod = 1e9 + 7;
void solve()
{
int n, m;
cin >> n >> m;
priority_queue<int,vector<int>,greater<int>>q;
for (int i = 0; i < n; i++){
int x;
cin >> x;
q.push(x);
}
while(m --){
auto u = q.top();
q.pop();
q.push(u * 2);
}
int ans = 0;
while(q.size()){
auto u = q.top();
q.pop();
ans += u;
ans %= mod;
}
cout << ans % mod<< endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int _;
_ = 1;
//cin >> _;
while (_--)
{
solve();
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define PII pair<int, int>
const int N = 1e5+10;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
int gcd(int x,int y){
return y ? gcd(y, x % y) : x;
}
const int mod = 1e9 + 7;
void solve()
{
int n, m;
cin >> n >> m;
priority_queue<int,vector<int>,greater<int>>q;
for (int i = 0; i < n; i++){
int x;
cin >> x;
q.push(x);
}
while(m --){
auto u = q.top();
q.pop();
q.push(u * 2);
}
int ans = 0;
while(q.size()){
auto u = q.top();
q.pop();
ans += u;
ans %= mod;
}
cout << ans % mod<< endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int _;
_ = 1;
//cin >> _;
while (_--)
{
solve();
}
return 0;
}
Details
answer.code:57:11: error: redefinition of ‘const long long int N’ 57 | const int N = 1e5+10; | ^ answer.code:6:11: note: ‘const long long int N’ previously defined here 6 | const int N = 1e5+10; | ^ answer.code:58:5: error: redefinition of ‘long long int dx [4]’ 58 | int dx[4] = {-1, 0, 1, 0}; | ^~ answer.code:7:5: note: ‘long long int dx [4]’ previously defined here 7 | int dx[4] = {-1, 0, 1, 0}; | ^~ answer.code:59:5: error: redefinition of ‘long long int dy [4]’ 59 | int dy[4] = {0, 1, 0, -1}; | ^~ answer.code:8:5: note: ‘long long int dy [4]’ previously defined here 8 | int dy[4] = {0, 1, 0, -1}; | ^~ answer.code:60:5: error: redefinition of ‘long long int gcd(long long int, long long int)’ 60 | int gcd(int x,int y){ | ^~~ answer.code:9:5: note: ‘long long int gcd(long long int, long long int)’ previously defined here 9 | int gcd(int x,int y){ | ^~~ answer.code:63:11: error: redefinition of ‘const long long int mod’ 63 | const int mod = 1e9 + 7; | ^~~ answer.code:12:11: note: ‘const long long int mod’ previously defined here 12 | const int mod = 1e9 + 7; | ^~~ answer.code:64:6: error: redefinition of ‘void solve()’ 64 | void solve() | ^~~~~ answer.code:13:6: note: ‘void solve()’ previously defined here 13 | void solve() | ^~~~~ answer.code:88:8: error: redefinition of ‘int main()’ 88 | signed main() | ^~~~ answer.code:37:8: note: ‘int main()’ previously defined here 37 | signed main() | ^~~~