#include "cmp.h"
#include <bits/stdc++.h>
using namespace std;
const int num[4] = {12, 10, 8, 6};
const int st[4] = {480, 48, 6, 1};
const int ind[4] = {100, 200, 300, 400};
vector <int> uniq[4096];
bool flag;
void remember(int n) {
if(!flag) {
flag = true;
for(int i = 0; i < 4096; ++i) {
int now = i, base = 1;
for(int j = 0; j < 4; ++j) {
int x = now / st[j];
uniq[i].push_back(ind[j] + x);
now %= st[j];
}
}
}
for(int i = 0; i < uniq[n].size(); ++i)
bit_set(uniq[n][i]);
}
int compare(int b) {
for(int i = 0; i < uniq[b].size(); ++i) {
int ost = uniq[b][i] - ind[i];
if(bit_get(ost + ind[i]))
continue;
if(ost + ost < num[i]) {
--ost;
for(; ost >= 0; --ost)
if(bit_get(ost + ind[i]))
return 1;
return -1;
}
else {
++ost;
for(; ost < num[i]; ++ost)
if(bit_get(ost + ind[i]))
return -1;
return 1;
}
}
return 0;
}
Compilation message
cmp.cpp: In function 'void remember(int)':
cmp.cpp:15:26: warning: unused variable 'base' [-Wunused-variable]
int now = i, base = 1;
^~~~
cmp.cpp:23:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < uniq[n].size(); ++i)
~~^~~~~~~~~~~~~~~~
cmp.cpp: In function 'int compare(int)':
cmp.cpp:28:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < uniq[b].size(); ++i) {
~~^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2256 ms |
84016 KB |
Output is correct - maxAccess = 10, score = 100 |