QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#732004#9599. Dragon BloodlineyzhxCompile Error//C++202.0kb2024-11-10 12:41:442024-11-10 12:41:48

Judging History

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

  • [2024-11-10 12:41:48]
  • 评测
  • [2024-11-10 12:41:44]
  • 提交

answer

 #include <iostream>
 #include <cstring>
 #include <algorithm>
 #include <queue>
 ​
 using namespace std;
 #define int long long
 const int N = 5e4 + 10;
 int n, k, a[N], b[35], c[35], d[35];
 ​
 bool check(int mid) {
     for(int i = 0; i <= 25; i ++ ) c[i] = 0;
     for(int i = 0; i <= 25; i ++ ) d[i] = b[i];
     priority_queue<int> q;
     for(int i = 1; i <= n ; i ++ ) {
         int x = mid * a[i];
         q.push(x);
     }
     
     for(int i = 19; ~i ; i -- ) {
         if(q.size() && q.top() <= (1 << i) && d[i]) {
             q.pop();
             d[i] -- ;
         }
         while(q.size() && q.top() >= (1 << i) && d[i]) {
             int t = q.top();
             int tt = t / (1 << i);
             int ttt = min(tt, d[i]);
             tt -= ttt, d[i] -= ttt;
             q.pop();
             if(t - ttt * (1 << i) == 0) continue;
             q.push(t - ttt * (1 << i));
             
         }
         while(q.size() && q.top() <= (1 << i) && d[i]) {
             q.pop();
             d[i] -- ;
         }
     }
 ​
     int j = 19;
     while(q.size()) {
         if(j <= 0) break;
         while(j >= 0 && !d[j]) j -- ;
         while(q.size() && j >= 0 && (1 << j) > q.top() && d[j]) {
             if(j < 0) break;
             d[j] -- ;
             q.pop();
         }
         j -- ;
     }
     if(q.size()) return false;
     return true;
 }
 ​
 void solve() {
     cin >> n >> k;
     memset(b, 0, sizeof b);
     int per = 0, sum = 0;
     for(int i = 1; i <= n ; i ++ ) cin >> a[i], per += a[i];
     for(int i = 0; i < k ; i ++ ) cin >> b[i], sum += (1 << i) * b[i];
     
     int l = 0, r = sum / per;
     while(l < r) {
         int mid = l + r + 1 >> 1;
         if(check(mid)) l = mid;
         else r = mid - 1; 
     }
     cout << l << endl;
 }
 ​
 signed main() {
     ios::sync_with_stdio(0), cin.tie(0);
     int T = 1;
     cin >> T;
     while(T -- ) solve();
     return 0;
 }

详细

answer.code:5:2: error: ‘​’ does not name a type
    5 |  ​
      |   
answer.code:10:2: error: ‘​’ does not name a type
   10 |  ​
      |   
answer.code:55:2: error: ‘​’ does not name a type
   55 |  ​
      |   
answer.code:71:2: error: ‘​’ does not name a type
   71 |  ​
      |