#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().
vector<pair<int,int>> Alice(){
// add your code here
// change below into your code
long long x = setN(5000);
vector<pair<int, int>> p;
vector<int> bits;
for(int i = 0; i < 60; i++)
{
if(x & (1ll << i))
{
bits.push_back(i+2);
}
}
int m = 1;
for(int i = 1; i <= 5000 and p.size() < 4999; i++)
{
for(int j = 0; j < bits.size() and p.size() < 4999; j++)
{
p.push_back({i, bits[j]});
}
}
random_shuffle(p.begin()+1, p.end());
return p;
}
#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;
// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().
long long Bob(vector<pair<int, int>> V)
{
// add your code here
set<int> bits;
for (auto el : V)
{
bits.insert(el.first - 2);
}
long long x = 0;
for (int el : bits)
{
x |= (1ll << el);
}
return x; // change this into your code
}
Compilation message
Alice.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Alice.cpp:26:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
26 | for(int j = 0; j < bits.size() and p.size() < 4999; j++)
| ~~^~~~~~~~~~~~~
Alice.cpp:23:9: warning: unused variable 'm' [-Wunused-variable]
23 | int m = 1;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |