Блог пользователя atcoder_official

Автор atcoder_official, история, 26 часов назад, По-английски

We will hold KAJIMA CORPORATION CONTEST 2025 (AtCoder Beginner Contest 394).

We are looking forward to your participation!

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

»
12 часов назад, # |
  Проголосовать: нравится +43 Проголосовать: не нравится

If this ABC as shit as the last ABC, I will ban you.

  • »
    »
    5 часов назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    lol

  • »
    »
    4 часа назад, # ^ |
      Проголосовать: нравится +3 Проголосовать: не нравится

    Although you are not the true system user, I still upvote your comment.

  • »
    »
    3 часа назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    I really hope this will come true.

  • »
    »
    71 минуту назад, # ^ |
    Rev. 3   Проголосовать: нравится +3 Проголосовать: не нравится

    As shit as before

»
8 часов назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

it seems blogs of ABC get less and less upvotes even get downvotes.

upd: this round is worse than last one again.

»
7 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Wish no more AI Best Contest plz.

»
5 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

painful

»
75 минут назад, # |
  Проголосовать: нравится -7 Проголосовать: не нравится

Why ABC G. is so hard?

»
58 минут назад, # |
Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

Problem E is very similar to [POI 2009] Bytie-boy's Walk.

In POI, it shows us that E can be solved with time complexity $$$O(n^2V+nm)$$$. ($$$V=26$$$, $$$m$$$ is the number of edges).

»
57 минут назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Why this gives TLE for E in 2 test cases ?

Code
»
56 минут назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve E?

»
55 минут назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

man how i do the c better than this ? Sorry my english is bad :(

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define f first
#define s second

bool temWA(string str){
    for(int i = 0; i < str.length() - 1; i++){
        if(str[i] == 'W' && str[i+1] == 'A') return true;
    }

    return false;
}


int main(){
    string str; cin >> str;
    
    while(temWA(str)){
        for(int i = 0; i < str.length() - 1; i++){
        if(str[i] == 'W' && str[i+1] == 'A'){
            str[i] = 'A';
            str[i+1] = 'C';
        }
    }
    }

    cout << str << endl;
}

»
54 минуты назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I don't know if problems like A and B should be even in a beginner contest! Atcoder became more reliant on speed more than anything else. Problem E was pain ngl

»
53 минуты назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Anyone could please provide a testcase for my submissión for problem D? I failed just two cases :')

My submission

Thanks in advance

»
52 минуты назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

after contest i tried with o3-mini it solves E in one shot after giving my intuition. my TLE code : https://atcoder.jp/contests/abc394/submissions/63054891 o3-mini code: https://atcoder.jp/contests/abc394/submissions/63064525

today's problem set was nice but D was way more easier than C for me

»
51 минуту назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Why is this wrong for F Alkane?

Code
  • »
    »
    30 минут назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I had the same idea and i can't figure out what's wrong either...

  • »
    »
    22 минуты назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    This is wrong because you can take the nodes which have degree > 4 in the original graph to be the part of the subgraph. You just need to ensure that in the subgraph the degree is exactly 4.

    E.g. case:

    6
    1 2
    1 3
    1 4
    1 5
    1 6
    

    Here in the original graph, the degree of node 1 is 5, your solution will ignore the node 1. But you can take nodes 1, 2, 3, 4, 5 and create an alkane out of them.

    • »
      »
      »
      20 минут назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      OH Yes you are right , i mistakenly thought that given inputs are having degree of any node at max 4

»
41 минуту назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

The problems in ABC contests are becoming increasingly easier, making rankings largely dependent on the speed of coding.

e.g. slower 10 min will get nearly 1000 rank down

»
40 минут назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

Me,too. Why is this wrong for F Alkane?

I use Tree dp and classification discussion,but WA;

Who can give me a sample ,or find my mistake.

Thanks!

#include<bits/stdc++.h>
using namespace std;
#define ll long long 
vector<ll> v[200050];
ll du[200050];
vector<ll> st[200050];
map<ll,ll> mp[200050];
bool cmp(ll c,ll d)
{
	return c>d;
}
ll dfs(ll fa,ll now)
{
	if(mp[fa].count(now))
	{	
		return mp[fa][now];
	}
	if(du[now]>=4)
	{
		st[now].clear();
		for(ll it:v[now])
		{
			if(it!=fa)
			{
				ll k=dfs(now,it);
				st[now].push_back(k);
			}	
		}
		sort(st[now].begin(),st[now].end(),cmp);
		ll res=0;
		ll m=st[now].size();
		for(ll i=0;i<=m-1&&i<=3;i++)
		{
			res+=st[now][i];
		}
		return mp[fa][now]=res+1;
	}
	else
	{
		return mp[fa][now]=1;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n;
	cin>>n;
	ll x,y;
	for(ll i=1;i<=n-1;i++)
	{
		cin>>x>>y;
		v[x].push_back(y);
		du[x]++;
		v[y].push_back(x);
		du[y]++;
	}
	ll maxx=-1;
	for(ll i=1;i<=n;i++)
	{
		if(du[i]>=4)
		{
			maxx=max(maxx,dfs(0,i));
		}
	}
	cout<<maxx;
	return 0;
}``
»
39 минут назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

For Problem F: My code is working on 1-39 testcases, and WA on 40-59, please find error...

Your code here...
void dfs(ll x, vector<bool>& vis,vector<set<ll>>& graph,ll& c)
{
    c++;
    vis[x]=true;
    for(ll i:graph[x])
    {
        if(!vis[i])
        {
            dfs(i,vis,graph,c);
        }
    }
}

void solve()
{
    ll n;
    cin>>n;
    vector<set<ll>> num(n+1);
    for(ll i=1; i<n; i++)
    {
        ll a,b;
        cin>>a>>b;
        num[a].insert(b);
        num[b].insert(a);
    }

    queue<ll> q;
    for(ll i=1; i<=n; i++) if(num[i].size()==1) q.push(i);

    ll ans=0;

    while(!q.empty())
    {
        ll x = q.front();
        q.pop();
        ll p = *num[x].begin();
        ll s = num[p].size();
        if(s==1)
        {
            num[x].erase(p);
            num[p].erase(x);
        }else if(s==2)
        {
            num[x].erase(p);
            num[p].erase(x);
            q.push(p);
        }else if(s==3)
        {
            num[x].erase(p);
            num[p].erase(x);
        }else if(s>4)
        {
            num[x].erase(p);
            num[p].erase(x);
        }
    }
    vector<bool> vis(n+1,false);
    for(ll i=1; i<=n; i++)
    {
        if(num[i].size()==0) continue;
        else
        {
            ll c=0;
            dfs(i,vis,num,c);
            cout<<c<<"\n";
            return;
        }
    } 
    cout <<"-1\n";

} 
»
36 минут назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Problems suddenly got considerably hard starting from E. I breezed through A~D in 20 minutes, and spent 60 minutes to solve E.

  • »
    »
    17 минут назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    This is just the serious problem in ABC.

    For coders can only solve A~D, they should code very fast to get good ranks.

»
26 минут назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve G? I figured that the optimal route will pass through a floor f such that when considering only buildings with heights >=f, the source and destination would belong to same connected component.

To find this value of f for each query, I thought I could do a binary search but then maintaining the UnionFind structure would take O(N) per query, which is too slow. Another approach I thought of was to solve offline by adding each building one-by-one in decreasing order but then needing to check all Q queries after each addition is again too slow.

  • »
    »
    21 минуту назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    consider small to large

  • »
    »
    14 минут назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    You can construct a minimum spanning tree and then use binary lifting to find the minimal edge weight on the path between nodes.

    • »
      »
      »
      5 минут назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      I suppose the edge weights when constructing MST are simply the heights of building in each cell? Then I have a follow-up question:

      Let's say that there are two nodes A and B and minimum wt edge on the path A->B in MST is X. How do I know that there is not another path (not covered by the MST) that contains Y (>X) and also connect A and B? It's possible that going from source to dest using this Y edge would be cheaper, isn't it?

»
26 минут назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

In ABC394 I played this match in the same room as CHI_LI I went to the toilet after making the E question He stole my code and made almost no changes Don't ban me I'm also a victim

  • »
    »
    15 минут назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    My AtCoder's name is Huang_Barry.I'm Chinese,My English ability is not good.

  • »
    »
    10 минут назад, # ^ |
      Проголосовать: нравится +2 Проголосовать: не нравится

    I am CHI_li, I surrender myself and I admit to what 'HuangBarry' said. I am very sorry for this. Because I was on a whim, I shouldn't have plagiarized. After he came back and found out that I had plagiarized, he told me the rules, which would result in my account being banned. I was afraid that my teacher would..., I promise that I will never violate the rules in the future.

»
21 минуту назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

G is not good. Extremely straightforward idea, but pain in the ass to implement, not what I expect from atcoder contests. Rest of the problems were alright tbh.

»
2 минуты назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Is there some easier to understand solution for E compared to the editorial ?