Hello codeforces community, my friend Vicfred is repeatedly cheating in contest copying codes from youtube/telegram or using LLM. I have tried to talk to him to persuade him to stop but he continue doing it without any remorse. Here is the proofs:
Edu round 178 — problem B
Leaked code from telegram:
Spoiler#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define endl "\n"
#define vec vector
//#define int long long
#define pii pair<int, int>
#define se second
#define fi first
#define pb push_back
#define maxel(v) *max_element(v.begin(), v.end())
#define minel(v) *min_element(v.begin(), v.end())
#define yes cout << "YES\n";
#define m1 cout << "-1\n";
#define no cout << "NO\n";
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
template <typename T>
void printa(const vec<T> a) {
for (auto& p: a) {
cout << p << ' ';
}
cout << endl;
}
template<typename T1, typename T2>
ostream& operator << (ostream& out, const pair<T1, T2>& p){
return out << "(" << p.first << ", " << p.second << ")";
}
template<typename T>
ostream& operator << (ostream& out, const vector<T>& v){
out << "[";
for (int i = 0; i < v.size(); i++){
if (i) out << ", ";
out << v[i];
}
out << "]";
return out;
}
template<typename T1, typename T2>
istream& operator >> (istream& in, pair<T1, T2>& p){
in >> p.first;
in >> p.second;
return in;
}
template<typename T>
istream& operator >> (istream& in, vector<T>& v){
for (auto& e : v) in >> e;
return in;
}
template <typename T>
void printrb(vector<T>* rb, int n) {
for (int u = 0; u < n; ++u) {
for (const T& v : rb[u]) {
cout << u << " -> " << v << '\n';
}
}
}
template <typename T>
void print2d(const vec<vec<T>> &vec) {
for (const auto &row : vec) {
for (const auto &i : row) {
cout << i << " ";
}
cout << endl;
}
}
void solve() {
int n;
cin >> n;
vec<ll> a(n+1);
for (int i = 1; i <= n; i++)
cin >> a[i];
vec<ll> pref(n+1), suf(n+2);
pref[1] = a[1];
for (int i = 2; i <= n; i++)
pref[i] = max(pref[i-1], a[i]);
suf[n+1] = 0;
for (int i = n; i >= 1; i--)
suf[i] = suf[i+1] + a[i];
for (int k = 1; k <= n; k++) {
int pi = n - k + 1;
ll s1 = suf[n - k + 2];
ll s2 = suf[pi];
ll ans = max(s1 + pref[pi], s2);
cout << ans << " ";
}
cout << endl;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tests; cin >> tests;
for (int i = 0; i < tests; ++i)
solve();
}
Submission: 317600650.
Just look the solve function the logic is the same but the problem was easy so maybe is a coincidence right?
Round 1022 — problem B, C
Full leaked code problem B:
Spoiler#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline int pc(ll x) { return __builtin_popcountll(x); }
ll min2(ll r) {
if (r == 0) return 2;
int p = pc(r);
if (p >= 2) return r;
for (int k = 0; k < 31; k++) {
if (!((r >> k) & 1)) {
ll s = 1LL << k;
return r + 2*s;
}
}
return r + 2;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
ll n, x;
cin >> n >> x;
if (n == 1) {
cout << (x>0 ? x : -1) << "\n";
continue;
}
ll ans = LLONG_MAX;
int maxk = (int)min<ll>(n, 30);
for (int k = 1; k <= maxk; k++) {
int xorOnes = (int)((n - k) & 1);
ll r = x ^ xorOnes;
ll sk = LLONG_MAX;
if (k == 1) {
if (r > 0) sk = r;
}
else if (k == 2) {
sk = min2(r);
}
else {
if (r == 0 && k == 3) {
sk = 6; // {1,2,3}
} else if (pc(r) >= k) {
sk = r;
}
}
if (sk < LLONG_MAX) {
ans = min(ans, (n - k) + sk);
}
}
cout << (ans==LLONG_MAX ? -1 : ans) << "\n";
}
return 0;
}
Submission: 317993913.
At first the codes seems slightly different but if you take a closer look Vicfred removes min2 function and write his own way to count on bits.
Leaked code problem C:
Spoiler#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<long long> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
int ans = 0;
for (int i = 0; i < n; ) {
int j = i;
while (j + 1 < n && a[j + 1] == a[i]) {
++j;
}
long long v = a[i];
bool left_ok = (i == 0) || (a[i - 1] < v);
bool right_ok = (j == n - 1) || (a[j + 1] < v);
if (left_ok && right_ok) {
++ans;
}
i = j + 1;
}
cout << ans << "\n";
}
return 0;
}
Submission: 317987925.
Nothing to say here the codes are practically identical just change some variable names.
Round 1028 — problem C, D
Leaked code problem C:
Spoiler#include <bits/stdc++.h>
#define int long long
#define endl "\n"
#define vec vector
#define pb push_back
#define INF INT_MAX
#define se second
#define fi first
#define pii pair<int, int>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pll pair<long long, long long>
#define str string
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
const int MOD = 1000000007;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
void solve() {
int n;
cin >> n;
vec<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int g = a[0];
for (int i = 1; i < n; i++) {
g = gcd(g, a[i]);
}
int cnt_g = 0;
for (int i = 0; i < n; i++) {
if (a[i] == g) cnt_g++;
}
if (cnt_g > 0) {
cout << (n - cnt_g) << endl;
return;
}
vec<int> orig = a;
sort(all(orig));
orig.erase(unique(all(orig)), orig.end());
int maxv = orig.back();
vec<int> dist(maxv + 1, -1);
queue<int> q;
for (int v : orig) {
dist[v] = 0;
q.push(v);
}
while (!q.empty()) {
int v = q.front();
q.pop();
if (v == g) break;
for (int u : orig) {
int d = gcd((int)v, (int)u);
if (dist[d] == -1) {
dist[d] = dist[v] + 1;
q.push(d);
}
}
}
int cost_first = dist[g];
int ans = cost_first + (n - 1);
cout << ans << endl;
}
signed main() {
#ifdef LOCAL
freopen("a2.txt","r", stdin);
freopen("a2.txt","w", stdout);
#endif LOCAL
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t;
cin >> t;
for (int i = 0; i < t; i++) {
solve();
}
return 0;
}
Submission: 322242525.
After last contest i talk to him about i found he was cheating so from this contest he started to submit codes writen in D. First he tries his own idea but got TLE then submit D version on leaked code getting several times CE and finally AC.
Leaked code D:
Spoiler#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct SegTree {
int n;
int sz;
vector<int> data;
SegTree(int n_orig) {
n = n_orig;
sz = 1;
while (sz < n) sz <<= 1;
data.assign(2 * sz, 0);
}
void build_initial() {
for (int i = 1; i <= n; i++) {
data[sz + i - 1] = i;
}
for (int i = sz - 1; i >= 1; i--) {
data[i] = 0;
}
}
void update(int pos, int v) {
int idx = sz + pos - 1;
data[idx] = v;
idx >>= 1;
while (idx >= 1) {
data[idx] = 0;
idx >>= 1;
}
}
int query(int pos) const {
return data[sz + pos - 1];
}
};
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int N, Q;
cin >> N >> Q;
vector<ll> finalB(N + 1);
for (int i = 1; i <= N; i++) {
cin >> finalB[i];
}
int tot = N + Q;
vector<int> leftChild(tot + 1, 0), rightChild(tot + 1, 0);
vector<char> isRoot(tot + 1, 0);
vector<ll> lowerBound(tot + 1, 0);
vector<ll> answerVal(tot + 1, 0);
SegTree st(N);
st.build_initial();
for (int i = 1; i <= Q; i++) {
int xi, yi, zi;
cin >> xi >> yi >> zi;
int u = N + i;
int nodeX = st.query(xi);
int nodeY = st.query(yi);
leftChild[u] = nodeX;
rightChild[u] = nodeY;
st.update(zi, u);
}
for (int i = 1; i <= N; i++) {
int r = st.query(i);
isRoot[r] = 1;
}
for (int i = 1; i <= N; i++) {
int r = st.query(i);
if (lowerBound[r] == 0) {
lowerBound[r] = finalB[i];
}
}
bool possible = true;
for (int u = tot; u >= 1; u--) {
if (u > N && lowerBound[u] > 0) {
ll lb_u = lowerBound[u];
int v1 = leftChild[u];
int v2 = rightChild[u];
if (lowerBound[v1] < lb_u) {
if (isRoot[v1]) {
possible = false;
break;
}
lowerBound[v1] = lb_u;
}
if (lowerBound[v2] < lb_u) {
if (isRoot[v2]) {
possible = false;
break;
}
lowerBound[v2] = lb_u;
}
}
}
if (!possible) {
cout << "-1\n";
continue;
}
for (int u = 1; u <= tot; u++) {
if (u <= N) {
answerVal[u] = lowerBound[u];
} else {
int v1 = leftChild[u];
int v2 = rightChild[u];
ll candidate = min(answerVal[v1], answerVal[v2]);
if (isRoot[u]) {
if (candidate != lowerBound[u]) {
possible = false;
break;
}
answerVal[u] = candidate;
} else {
answerVal[u] = candidate;
}
}
}
if (!possible) {
cout << "-1\n";
} else {
for (int i = 1; i <= N; i++) {
cout << answerVal[i] << (i == N ? '\n' : ' ');
}
}
}
return 0;
}
Submission: 322284644. Im not very well versed in D so not 100% sure if he cheat this one.
He even got the top 300 in this round by cheating.
Round 1031 — problem A, C
Leaked code A:
Spoiler#include <bits/stdc++.h>
#define int long long
#define endl "\n"
#define vec vector
#define pb push_back
#define INF INT_MAX
#define se second
#define fi first
#define pii pair<int, int>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pll pair<long long, long long>
#define str string
using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
const int MOD = 1000000007;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using namespace std;
void solve() {
int k, a, b, x, y;
cin >> k >> a >> b >> x >> y;
if (x > y) {
swap(a, b);
swap(x, y);
}
int cnt1 = 0;
if (k >= a) {
cnt1 = (k - a) / x + 1;
}
k -= cnt1 * x;
int cnt2 = 0;
if (k >= b) {
cnt2 = (k - b) / y + 1;
}
cout << (cnt1 + cnt2) << endl;
}
signed main() {
#ifdef LOCAL
freopen("a2.txt","r", stdin);
freopen("a2.txt","w", stdout);
#endif LOCAL
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t;
cin >> t;
while (t--) {
solve();
}
}
Submission: 324471709 324472441.
First he used swap function but changed with xor.
Even after ACed A and B using D language, he first tried problem C using C++ and after getting WA two times just before the end of contest submited D version of leaked code.
Spoiler#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int n, m, k;
cin >> n >> m >> k;
vector<string> g(n);
for (auto& s : g) cin >> s;
vector<vector<int>> pref(n + 1, vector<int>(m + 1, 0));
int total = 0;
for (int i = 0; i < n; ++i)
for (int j = 0; j < m; ++j) {
int add = (g[i][j] == 'g');
total += add;
pref[i + 1][j + 1] =
pref[i + 1][j] + pref[i][j + 1] - pref[i][j] + add;
}
auto goldInRect = [&](int x1, int y1, int x2, int y2) -> int {
if (x1 > x2 || y1 > y2) return 0;
return pref[x2 + 1][y2 + 1] - pref[x1][y2 + 1]
- pref[x2 + 1][y1] + pref[x1][y1];
};
int bestLoss = INT_MAX;
int inner = k - 1;
for (int x = 0; x < n; ++x)
for (int y = 0; y < m; ++y)
if (g[x][y] == '.') {
int x1 = max(0, x - inner);
int y1 = max(0, y - inner);
int x2 = min(n - 1, x + inner);
int y2 = min(m - 1, y + inner);
int loss = goldInRect(x1, y1, x2, y2);
bestLoss = min(bestLoss, loss);
}
cout << total - bestLoss << '\n';
}
return 0;
}
Submission: 324512719.
He also tried D and E usign C++ with help of LLM.
Atcoder ABC 408, 409, 410
Im very sure Vicfred is also cheating in most recent atcoder abc rounds, take a look this submission of abc410_f didnt bother to remove AI comments, after a few attempts got AC and very high place among rated users.
Also on saturday 31 of may he attended ABC408 and Codeforces 1028 but all his atcode codes are writen in C++ and codeforces in D.
I believe this behavior is unacceptable, regardless of who it comes from.