QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#100038#4923. 整数lingchenCompile Error//C++141011b2023-04-24 14:55:122023-04-24 14:55:15

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-24 14:55:15]
  • 评测
  • [2023-04-24 14:55:12]
  • 提交

answer

#include "integer.h"
#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;

#define cnt(x) __builtin_popcount(x)
int p[5100],a[5100],b[5100];

vector<int> findPermutation (int n)
{
    iota(p, p+n, 0);
    shuffle(p, p+n, mt19937((random_device())()));
    memset(a, -1, sizeof(a));
    memset(b, -1, sizeof(b));

    for(int i=0; i<n; i++) operate(i);
    int t=0,pre=n;
    bool flag=1;
    while(flag)
    {
        vector<int> v; flag=0;
        for(int i=0,tt=n+cnt(t)-cnt(t+1)+1; i<n; i++)
        if(a[p[i]]==-1)
        {
            int now=operate(p[i]);
            if(pre>=now)
            tt-=pre-now+1, a[p[i]]=tt;
            pre=now;
        }
        for(int i=0; i<n; i++)
        {
            if(b[i]!=-1) pre=operate(i);
            if(a[i]==0) pre=operate(i);
            if(a[i]==-1) flag=1;
        }
        memcpy(b, a, sizeof(a)); ++t;
    }

    vector<int> ans;
    for(int i=0; i<n; i++) ans.push_back(a[i]);
    return ans;
}

详细

implementer.cpp: In function ‘void integer_grader_F0F01B59EA9BF23E::generateToken()’:
implementer.cpp:19:57: warning: format ‘%llX’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘std::mersenne_twister_engine<long unsigned int, 64, 312, 156, 31, 13043109905998158313, 29, 6148914691236517205, 17, 8202884508482404352, 37, 18444473444759240704, 43, 6364136223846793005>::result_type’ {aka ‘long unsigned int’} [-Wformat=]
   19 |                 for(int i = 1; i <= 40; i++) printf("%llX", (rng() & 15));
      |                                                      ~~~^   ~~~~~~~~~~~~
      |                                                         |          |
      |                                                         |          std::mersenne_twister_engine<long unsigned int, 64, 312, 156, 31, 13043109905998158313, 29, 6148914691236517205, 17, 8202884508482404352, 37, 18444473444759240704, 43, 6364136223846793005>::result_type {aka long unsigned int}
      |                                                         long long unsigned int
      |                                                      %lX
implementer.cpp: In function ‘void integer_grader_F0F01B59EA9BF23E::main()’:
implementer.cpp:47:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   47 |                 scanf("%d", &n);
      |                 ~~~~~^~~~~~~~~~
implementer.cpp:49:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   49 |                         scanf("%d", p + i);
      |                         ~~~~~^~~~~~~~~~~~~
answer.code:2:10: fatal error: grader.cpp: No such file or directory
    2 | #include "grader.cpp"
      |          ^~~~~~~~~~~~
compilation terminated.