QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#418484#8723. 乘二paoxiaomo#Compile Error//C++201.2kb2024-05-23 14:11:352024-05-23 14:11:35

Judging History

你现在查看的是最新测评结果

  • [2024-05-23 14:11:35]
  • 评测
  • [2024-05-23 14:11:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9+7;
int qp(int a, int n) {
    int res = 1;
    while (n) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD, n >>= 1;
    }
    return res;
}
void Prework() {

}
void Solve() {
    int n, k;cin >> n >> k;
    vector<int> a(n + 1); for (int i = 1;i <= n;i++) cin >> a[i];
    priority_queue <array<int, 2>, vector<array<int, 2>>, greater<array<int, 2>>> q;
    for (int i = 1;i <= n;i++) {
        q.push({ 0,a[i] });
    }
    int cnt = 0;
    while (k) {
        k--;
        auto [x, y] = q.top();q.pop();
        y = y * 2;
        if (y >= MOD) x += 1, y -= MOD;
        if (x == 1) cnt += 1;
        q.push({ x,y });
        if (cnt == n) {
            break;
        }
    }
    int yu = k % n;
    int base = k / n;
    int res = 0;
    for (int i = 1;i <= n;i++) {
        auto [x, y] = q.top();q.pop();
        if (i <= yu) res = (res + qp(2, base + 1) * y % MOD) % MOD;
        else res = (res + qp(2, base) * y % MOD) % MOD;
    }
    cout << res << endl;
}

详细

answer.code:6:1: error: extended character   is not valid in an identifier
    6 |     int res = 1;
      | ^
answer.code:6:3: error: extended character   is not valid in an identifier
    6 |     int res = 1;
      |   ^
answer.code:7:1: error: extended character   is not valid in an identifier
    7 |     while (n) {
      | ^
answer.code:7:3: error: extended character   is not valid in an identifier
    7 |     while (n) {
      |   ^
answer.code:8:1: error: extended character   is not valid in an identifier
    8 |         if (n & 1) res = res * a % MOD;
      | ^
answer.code:8:3: error: extended character   is not valid in an identifier
    8 |         if (n & 1) res = res * a % MOD;
      |   ^
answer.code:8:5: error: extended character   is not valid in an identifier
    8 |         if (n & 1) res = res * a % MOD;
      |     ^
answer.code:8:7: error: extended character   is not valid in an identifier
    8 |         if (n & 1) res = res * a % MOD;
      |       ^
answer.code:9:1: error: extended character   is not valid in an identifier
    9 |         a = a * a % MOD, n >>= 1;
      | ^
answer.code:9:3: error: extended character   is not valid in an identifier
    9 |         a = a * a % MOD, n >>= 1;
      |   ^
answer.code:9:5: error: extended character   is not valid in an identifier
    9 |         a = a * a % MOD, n >>= 1;
      |     ^
answer.code:9:7: error: extended character   is not valid in an identifier
    9 |         a = a * a % MOD, n >>= 1;
      |       ^
answer.code:10:1: error: extended character   is not valid in an identifier
   10 |     }
      | ^
answer.code:10:3: error: extended character   is not valid in an identifier
   10 |     }
      |   ^
answer.code:11:1: error: extended character   is not valid in an identifier
   11 |     return res;
      | ^
answer.code:11:3: error: extended character   is not valid in an identifier
   11 |     return res;
      |   ^
answer.code:17:1: error: extended character   is not valid in an identifier
   17 |     int n, k;cin >> n >> k;
      | ^
answer.code:17:3: error: extended character   is not valid in an identifier
   17 |     int n, k;cin >> n >> k;
      |   ^
answer.code:18:1: error: extended character   is not valid in an identifier
   18 |     vector<int> a(n + 1); for (int i = 1;i <= n;i++) cin >> a[i];
      | ^
answer.code:18:3: error: extended character   is not valid in an identifier
   18 |     vector<int> a(n + 1); for (int i = 1;i <= n;i++) cin >> a[i];
      |   ^
answer.code:19:1: error: extended character   is not valid in an identifier
   19 |     priority_queue <array<int, 2>, vector<array<int, 2>>, greater<array<int, 2>>> q;
      | ^
answer.code:19:3: error: extended character   is not valid in an identifier
   19 |     priority_queue <array<int, 2>, vector<array<int, 2>>, greater<array<int, 2>>> q;
      |   ^
answer.code:20:1: error: extended character   is not valid in an identifier
   20 |     for (int i = 1;i <= n;i++) {
      | ^
answer.code:20:3: error: extended character   is not valid in an identifier
   20 |     for (int i = 1;i <= n;i++) {
      |   ^
answer.code:21:1: error: extended character   is not valid in an identifier
   21 |         q.push({ 0,a[i] });
      | ^
answer.code:21:3: error: extended character   is not valid in an identifier
   21 |         q.push({ 0,a[i] });
      |   ^
answer.code:21:5: error: extended character   is not valid in an identifier
   21 |         q.push({ 0,a[i] });
      |     ^
answer.code:21:7: error: extended character   is not valid in an identifier
   21 |         q.push({ 0,a[i] });
      |       ^
answer.code:22:1: error: extended character   is not valid in an identifier
   22 |     }
      | ^
answer.code:22:3: error: extended character   is not valid in an identifier
   22 |     }
      |   ^
answer.code:23:1: error: extended character   is not valid in an identifier
   23 |     int cnt = 0;
      | ^
answer.code:23:3: error: extended character   is not valid in an identifier
   23 |     int cnt = 0;
      |   ^
answer.code:24:1: error: extended character   is not valid in an identifier
   24 |     while (k) {
      | ^
answer.code:24:3: error: extended character   is not valid in an identifier
   24 |     while (k) {
      |   ^
answer.code:25:1: error: extended character   is not valid in an identifier
   25 |         k--;
      | ^
answer.code:25:3: error: extended character   is not valid in an identifier
   25 |         k--;
      |   ^
answer.code:25:5: error: extended character   is not valid in an identifier
   25 |         k--;
      |     ^
answer.code:25:7: error: extended character   is not valid in an identifier
   25 |         k--;
      |       ^
answer.code:26:1: error: extended character   is not valid in an identifier
   26 |         auto [x, y] = q.top();q.pop();
      | ^
answer.code:26:3: error: extended character   is not valid in an identifier
   26 |         auto [x, y] = q.top();q.pop();
      |   ^
answer.code:26:5: error: exten...