QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#951468 | #4923. 整数 | paul2008 | Compile Error | / | / | C++20 | 2.4kb | 2025-03-26 12:09:59 | 2025-03-26 12:10:03 |
Judging History
This is the latest submission verdict.
- [2025-03-26 12:10:03]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-03-26 12:09:59]
- Submitted
answer
#include "integer.h"
#include <bits/stdc++.h>
using namespace std;
const int N=5005;
int add[N];
vector<int> findPermutation (int n)
{
vector<int> ans;
for(int i=0;i<n;i++)
ans.push_back(-1);
int lst;
for(int i=0;i<n;i++)
lst=operate(i);
vector<int> nothave, have;
for(int i=0;i<n;i++)
nothave.push_back(i);
for(int i=0;i<=n;i++)
if(i&1)
add[i]=add[i/2]+1;
else
add[i]=0;
int lun=0;
while(nothave.size())
{
int topzero=n+add[lun];
for(auto x:nothave)
{
int now=operate(x);
if(now!=lst+1)
{
ans[x]=topzero-(lst+1-now);
topzero=ans[x];
}
lst=now;
}
for(auto x:have)
operate(x);
for(int i=0;i<n;i++)
if(ans[i]==0)
lst=operate(i);
lun++;
have.clear(), nothave.clear();
for(int i=0;i<n;i++)
if(ans[i]==-1)
nothave.push_back(i);
else
have.push_back(i);
}
return ans;
}
#include "integer.h"
#include <cstdio>
#include <cstdlib>
#include <cmath>
namespace SampleIntegerGrader
{
int n, p[1 << 21], S[1 << 21];
int currentPopcnt, ops;
double scoreof(const int s) {
if(s < 800000) return 1;
if(s <= 2000000) return 800000.0 / s;
if(s > 200000000) return 0;
return (9 - log10(s * 5)) / 5;
}
void reportResult(const std::vector<int> &answer) {
if((int)answer.size() != n)
puts("WA"), (void)printf("Invalid Answer length: expected %d, found %d\n", n, (int)answer.size()), exit(-1);
for(int i=0; i<n; i++)
if(answer[i] != p[i])
puts("WA"), (void)printf("Incorrect answer: p_%d is expected to be %d but found %d\n", i, p[i], answer[i]), exit(-1);
puts("OK"), (void)printf("Passed using %d operation(s): scoring %.3lf\n", ops, scoreof(ops));
}
void quitHalf(const int kth) {
puts("WA"), printf("Invalid query: Operation on %d violates range [0,%d]\n", kth, n - 1);
exit(-1);
}
int operate(const int kth) {
if(kth < 0 || kth >= n)
quitHalf(kth);
ops++;
S[p[kth]]++, currentPopcnt++;
for(int i = p[kth]; S[i] == 2; i++)
S[i] = 0, S[i + 1]++, currentPopcnt--;
return currentPopcnt;
}
void main() {
scanf("%d", &n);
for(int i = 0; i < n; i++) scanf("%d", p + i);
auto vans = findPermutation(n);
reportResult(vans);
}
}
int operate(const int kth) {
return SampleIntegerGrader::operate(kth);
}
int main() {
freopen("1.in","r",stdin);
SampleIntegerGrader::main();
return 0;
}
詳細信息
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: In function ‘void SampleIntegerGrader::main()’: answer.code:98:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 98 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ answer.code:99:49: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 99 | for(int i = 0; i < n; i++) scanf("%d", p + i); | ~~~~~^~~~~~~~~~~~~ answer.code: In function ‘int main()’: answer.code:108:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 108 | freopen("1.in","r",stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/bin/ld: /tmp/ccVsgpGz.o: in function `operate(int)': answer.code:(.text+0x2f0): multiple definition of `operate(int)'; /tmp/cc3g4Ghu.o:implementer.cpp:(.text+0x550): first defined here /usr/bin/ld: /tmp/ccVsgpGz.o: in function `main': answer.code:(.text.startup+0xc0): multiple definition of `main'; /tmp/cc3g4Ghu.o:implementer.cpp:(.text.startup+0xc0): first defined here collect2: error: ld returned 1 exit status