atcoder_official's blog

By atcoder_official, history, 45 hours ago, In English

We will hold AtCoder Beginner Contest 396.

We are looking forward to your participation!

  • Vote: I like it
  • +7
  • Vote: I do not like it

»
41 hour(s) ago, # |
  Vote: I like it 0 Vote: I do not like it

hope i don't choke myself on triple pointer questions again

»
23 hours ago, # |
  Vote: I like it +3 Vote: I do not like it

I am looking forward to it!!!

»
18 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Let's go

»
18 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Best of Luck everyone

»
18 hours ago, # |
  Vote: I like it -6 Vote: I do not like it

I am a Chinese. And you?

»
17 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I am looking forward to it!

»
16 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

man , what is wrong to this solution of C ?

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
    ll n, m; 
    cin >> n >> m;

    vector<ll> b(n), w(m);  

    for (ll i = 0; i < n; i++) cin >> b[i];
    for (ll i = 0; i < m; i++) cin >> w[i];

    ll ans = 0;
    sort(b.rbegin(), b.rend());
    sort(w.rbegin(), w.rend()); 

    ll contB = 0, parada = 0;
    
    for (ll i = 0; i < n; i++) {
        if (b[i] > 0) {
            ans += b[i];
            contB++;
        } else {
            parada = i;
            break;
        }
    }

    for (ll i = 0; i < min(contB, m); i++) { 
        if (w[i] > 0) {
            ans += w[i];
        } else {
            break;
        }
    }

    for (ll i = parada; i < min(n, m); i++) { 
        if (i < n && i < m && b[i] + ans + w[i] > ans) {
            ans += b[i] + w[i];
        } else {
            break;
        }
    }

    cout << ans << endl;
}

  • »
    »
    16 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You are adding repeated values to ans in the last loop, each value should be counted once.

    Hint
»
16 hours ago, # |
  Vote: I like it +67 Vote: I do not like it

I want to report user InequalityHanXu used AI (DeepSeek) to solve task G; please ban the user!

I believe many people used AI because their code is very similar.

  • »
    »
    16 hours ago, # ^ |
      Vote: I like it +16 Vote: I do not like it
    • »
      »
      »
      16 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      How do you explain people completely changing their coding style (templates, spacing etc.) when solving E, F, G?

  • »
    »
    16 hours ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    yeah. I totally agree with you. So many people use AI to solve problems in online competitions.

    It's an insult to the fairness. I think the user above should be banned as the poster said.

    We should take action to protect our contests from those methods that could create unfair competition, such as the use of AI.

    If left alone, why doesn't everyone use AI?

»
16 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Please help me hack this code:

#include <bits/stdc++.h>
#define __Made return
#define in 0
#define China__ ;
using namespace std;

int n, m;
long long b[200005], w[200005];
int p1 = 1, p2 = 1;
long long ans;

bool cmp(long long x, long long y) {
    return x > y;
}

int main()
{
    scanf("%d %d", &n, &m);
    for(int i = 1; i <= n; i++) scanf("%lld", &b[i]);
    for(int i = 1; i <= m; i++) scanf("%lld", &w[i]);
    sort(b + 1, b + n + 1, cmp);
    sort(w + 1, w + m + 1, cmp);
    while(b[p1] > 0 && w[p2] > 0)
        ans += b[p1] + w[p2], p1++, p2++;
    while(b[p1] > 0)
        ans += b[p1], p1++;
    while(b[p1] + w[p2] > 0)
        ans += b[p1] + w[p2], p1++, p2++;
    printf("%lld", ans);
    __Made in China__
}

I wonder how to fix it. Thank u!

  • »
    »
    16 hours ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    this is my solution,I think it will help you.

    #include<bits/stdc++.h>
    using namespace std;
    #define ll long long
    ll b[200050];
    ll w[200050];
    bool cmp(ll x,ll y)
    {
    	return x>y;
    }
    void solve()
    {
    	ll n,m;
    	cin>>n>>m;
    	for(ll i=1;i<=n;i++)
    	{
    		cin>>b[i];
    	}
    	for(ll i=1;i<=m;i++)
    	{
    		cin>>w[i];
    	}
    	sort(b+1,b+n+1,cmp);
    	sort(w+1,w+m+1,cmp);
    	ll ans=0;
    	for(ll i=1;i<=n;i++)
    	{
    		if(b[i]>=0&&w[i]>=0)
    		{
    			ans+=b[i]+w[i];
    		}
    		else if(b[i]>=0&&w[i]<0)
    		{
    			for(ll j=i;j<=n;j++)
    			{
    				if(b[j]>=0)
    				{
    					ans+=b[j];
    				}
    			}
    			break;
    		}
    		else if(w[i]+b[i]>0)
    		{
    			ans+=w[i]+b[i];
    		}
    	}
    	cout<<max(0ll,ans);
    }
    int main()
    {
    	ios::sync_with_stdio(false);
    	cin.tie(0);
    	ll _=1;
    	//cin>>_;
    	while(_--)
    	{
    		solve();
    	}
    	return 0;
    }
    
    
  • »
    »
    16 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I think the third while loop should come before second, because first if both of them are positive then we take both, if w[p2] < 0 we ignore, but if w[p2] > 0, we must take 1 black ball with it so we need to check w[p2]+b[p1] > 0 and at last if there are any positive value black balls left, then we can take those

    • »
      »
      »
      16 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      can you check mine — Submission

      • »
        »
        »
        »
        16 hours ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        The test case for which it fails is basic :

        1 3

        -1

        2 2 1

      • »
        »
        »
        »
        16 hours ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        It even fails for

        1 1

        0

        1

        Your check of strictly greater than 0 is causing the issue for this test case, maybe there are more issues too

    • »
      »
      »
      7 hours ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Wonderful, now my code isn't able to accept the first sample. :>

      I think the bug in my code is not this.

»
16 hours ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

I almost used 2-SAT to do D. Also,I didn't finish D in the contest.And is writting 105 lines normal for D?

UPD:I mean E.

UPD2:I meant I didn't finish writing the code for D.

UPD3:I mean E in UPD2.

  • »
    »
    16 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    It was just DFS wasnt it? Because the constraints were so small with N <= 10

    • »
      »
      »
      16 hours ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      You can solve it with a brute force approach. Like a dfs but trying all paths regardless of what nodes you've already visited

  • »
    »
    16 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Try to consider each bit? Then it will be easier to finish.

»
16 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

This was honestly a great context. Loved E and F, even though I didn't manage to solve it yet.

»
16 hours ago, # |
  Vote: I like it -7 Vote: I do not like it

Have nothing to do with F ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT ATCODER YOU ARE SO BAD YOU ABANDONED ME TAT

»
16 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I didn't make F and I made two incorrect submissions before making E. However, I think they're nice problems, especially problem E. I made it in a clever way using the Disjoint Set Union. I felt good about it :)

»
16 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I think D is much easier than before...

»
16 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

The Japanese statement says:

同じ頂点を $$$2$$$ 度以上通らないパス

I translated it by AI but it says(in Chinese):

不经过相同的顶点 $$$2$$$ 次以上

It means:

paths that do not pass through the same vertex more than twice

My english is poor,sorry.

And then I wrote this.

You can find it worong because this:

if(vis[nex]>=2) continue;

It's strange.

After the contest,I realized that the statement means:

paths that do not pass through the same vertex more than once

Why?

»
15 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

could anyone tell me why i'm WA on test 49? I don't know how to fix it

wrote #define int long long

»
15 hours ago, # |
  Vote: I like it +5 Vote: I do not like it

Another AI Beat Contest.

»
15 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

This is my Submission for c No. problem. What is wrong to this solution any explain please.....

  • »
    »
    13 hours ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    for(int i = 0 ;i<min(n, m);i++){
          //if(x==0)break;
          if(w[i]>-1 && b[i]>-1 && x>0){
              sumb+=w[i];
              x--;
          }
          if(b[i]<0 && (w[i]+b[i])>0)sumb+=(w[i]+b[i]);
    }
    

    $$$m \to \min(n, m)$$$

»
14 hours ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I want to report user gpt_4o used AI to solve task E; please ban the user!

I say that because it's very different from his everyday code style, but very similar to AI. The name gpt_4o is a blatant use of AI technology to compete, and the user has used AI-generated code to compete in the context of participating in the rating many times. This seriously deters the experience of the other contestants, defeats the purpose of the competition, and is an insult to every thoughtful, down-to-earth information competitor. Each of us urgently hopes that the authorities can strengthen the control of such behavior and quickly ban these users, thank you.

我这么说是因为这与他日常的代码风格大相径庭,却和AI非常相似。gpt_4o这个名字简直就是明目张胆的使用AI技术进行比赛,并且该用户已经非常多次在参与等级评定的情况下使用AI生成的代码来参赛了。这严重影响了其他选手的参赛体验,违背了举办这项比赛的初衷,这也是对每个认真思考的,脚踏实地的信息竞赛选手的侮辱。我们每个人都迫切希望官方能加强对此类行为的管控,快速封禁这些用户,感谢。

»
10 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Had thought of a $$$O(2^n.n^2)$$$ solution for problem D, but it gives WA for some test cases. Can someone help?

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define rep(i, a, b) for (int i = (a); i < (b); ++i)

constexpr ll INF = LLONG_MAX;

inline bool isBitSet(int num, int bitPos) {
    return ((num >> bitPos) & 1) != 0;
}

void solve() {
    int n, m; cin >> n >> m;
    vector<vector<ll>> adj(n, vector<ll>(n, INF));
    while (m--) {
        int a, b; ll w; 
        cin >> a >> b >> w;
        --a, --b;
        adj[a][b] = adj[b][a] = w;
    }
    vector<vector<ll>> pathXor(1 << n, vector<ll>(n, INF));
    pathXor[1][0] = 0;
    for (int path = 0; path < (1 << n); ++path) {
        for (int pathEnd = 0; pathEnd < n; ++pathEnd) {
            if (!isBitSet(path, pathEnd) || (pathXor[path][pathEnd] == INF)) 
                continue;
            for (int newDest = 0; newDest < n; ++newDest) {
                const ll weight = adj[pathEnd][newDest];
                if (isBitSet(path, newDest) || weight == INF) 
                    continue;
                const int newPath = path | (1 << newDest);
                pathXor[newPath][newDest] = min(pathXor[newPath][newDest], pathXor[path][pathEnd] ^ weight);
            }
        }
    }
    ll minPathXor = INF;
    for (int path = 0; path < (1 << n); ++path) {
        if (isBitSet(path, 0) && isBitSet(path, n - 1)) {
            minPathXor = min(minPathXor, pathXor[path][n - 1]);
        }
    }
    cout << minPathXor << "\n";
}

int main() {
    int T = 1;
    // cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}
»
7 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

https://atcoder.jp/contests/abc396/submissions/63519606 https://atcoder.jp/contests/abc396/submissions/63518496 https://atcoder.jp/contests/abc396/submissions/63530422 https://atcoder.jp/contests/abc396/submissions/63524401

The code above seems to be solved using an LLM (the code structures are very similar). If no action is taken, more people will start using LLMs in the competition. I hope necessary measures are taken.

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

I solved five problems!

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

我不演了,我是中国的