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

Автор atcoder_official, история, 22 месяца назад, По-английски

We will hold Toyota Programming Contest 2024#7(AtCoder Beginner Contest 362).

We are looking forward to your participation!

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

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится -37 Проголосовать: не нравится

Good luck, my friends!

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится -18 Проголосовать: не нравится

GL&HF!

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

Liked F but G ruined everything

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +43 Проголосовать: не нравится

Are you kidding? Why is task G the template of the Aho-Corasick Automaton?

Here is the template task in Luogu. They are the same.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Is g some standard problem?

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +40 Проголосовать: не нравится

Please stop giving problems that can be solved by just copying the template like G.

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

how to solve E

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

    very ez that dp

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

    I did it using 3d dp.

    This is my submission :https://atcoder.jp/contests/abc362/submissions/55562909 (was my first contest at atcoder :))

    I set dp[i][length][diff] = number of such sequences such that the ending position of subsequence is i , the length of subsequence is length and the difference of the AP is diff , i kept diff in a dictionary(map) as the value of diff could reach upto 10^9.

    After that just used dp[i][length+1][diff] += dp[j][length][diff]

    Since if there is subsequence of length k with difference diff and the current element minus j th element is equal to diff , then we could make a new subsequence of length legth+1

    Then for the final answer , just printed the summation of length for all i and diff.

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

How do you solve C? I managed to solve D and E but couldn't solve C

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

Can't believe so many people would SAM.

»
22 месяца назад, скрыть # |
Rev. 3  
Проголосовать: нравится +100 Проголосовать: не нравится

Atcoder, if you aren't able to set Gs then just remove them.

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

Solved F a couple of minutes after the contest has ended, eternal pain and suffering

Should have taken a hint from the problem name. Btw what's the actual way to do a matching in a case like this, without bruteforcing and abusing move-semantics?

»
22 месяца назад, скрыть # |
Rev. 2  
Проголосовать: нравится +29 Проголосовать: не нравится

Problems such as problem G shouldn't appeared in the contest. It is too original, and you just need to copy and paste without any thinking. Even worse to make G 575 but F 550, it should be reversed. It's super unfair for candidates who can solve F but doesn't know anything about AC automation.

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

how to do F ?

I could get somewhat idea to use Hungarian but that O(n^3) then whats the way to solve F or am i overthinking and using something which is useless like Hungarian in this case

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

    I kind of guessed F, if you find a centroid and start matching nodes from different subtrees of centroid then the actual pairs do not matter since they won't affect the answer, ie sum of all distances should stay the same (at least it feels like it). Then you have reduced the problem to matching integer values from different sets.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

I don't like this round. It has a template problem like G, it makes this round boring and unfair.(just my opinion)

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

E is similar to this problem.

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

The G problem is not a original problem.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

Delete G.

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

Can anyone help I am getting tle on last 2 test cases of problem d int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); lli n,m; cin>>n>>m; vectorarr; arr.push_back(0); for(int i=0;i<n;i++){ lli x; cin>>x; arr.push_back(x); } vector<pair<lli,lli>>mp[n+1];

for(int i=0;i<m;i++){ lli x,y,z; cin>>x>>y>>z; mp[x].push_back({y,z}); mp[y].push_back({x,z}); } vectordis(n+1,1e18); dis[1]=0;

priority_queue<pair<lli,lli>, vector<pair<lli,lli>>, greater<>> pq; pq.push({arr[1],1}); while(pq.size()>0){ lli dd=pq.top().first; lli vv=pq.top().second; pq.pop(); for(auto it:mp[vv]){

if(dis[it.first]>dd+it.second+arr[it.first]){
        dis[it.first]=dd+it.second+arr[it.first];

        pq.push({dis[it.first],it.first});
    }

}

} dis[1]=0; for(int i=2;i<=n;i++){ cout<<dis[i]<<" "; }

return 0; }

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

    bhai, you are pushing same node multiple times in the PQ.

    Lets say, graph,

    lets say, the input is

    4 5
    
    10 10 10 10 
    
    1 2 20
    
    2 3 1
    
    1 3 1
    
    1 4 1
    
    4 2 1 
    
    

    Please check, how many times you are pushing node value '2' in the queue.

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

    You should create an array called bool vis[] which stores whether each node has already been processed. Without this array, sometimes a node can be processed multiple times. Although this doesn't result in an infinite loop, this still significantly adds to the execution time. (Processed multiple times means the neighbors of the node is relaxed multiple times, which isn't necessary.)

    FYI the solution to this problem is that for every edge u->v with weight w, we simply add arr[v] to w. Then, we run a standard dijkstra and add arr[1] to our answer. Proof of correctness is fairly straightforward.

    PS: It is recommended to send submission links rather than the whole code. This is not only more aesthetically pleasing but also gives us more information on the submission, whether it TLEs or WAs, etc.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

I copied pasted my solution to G from CSES and changed 0 lines. I don't think problems like this should appear in a rated round. If problems like this are to appear, it should be in an unrated educational round (similar to the Atcoder DP contest a long time ago).

Link: https://cses.fi/problemset/task/2103

»
22 месяца назад, скрыть # |
Rev. 3  
Проголосовать: нравится -10 Проголосовать: не нравится

[DELETED]

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

This round was particularly frustrating, because I haven't seen G before and therefore spent a substantial amount of time on G. Hence, I finished the contest with ABCDE_G. However, I realized the greedy solution for F merely 5 minutes after the contest. If I had seen G before, I could focus on F and would have definitely full-solved. Not only did I not full-solve, my rating is probably going to be affected too, due to the fact that so many people have seen G before. I think many people are having the same thoughts, so atcoder_official, if you can't set G's, then don't. Having a contest with 6 problems is better than having a template question as the highest-point problem.

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +55 Проголосовать: не нравится

In fact, problem F is so similar to 1387B2 - Village (Maximum).

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

can someone please help me figure out the mistake in this ?

https://atcoder.jp/contests/abc362/submissions/55580896

»
22 месяца назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Does Dijkstra with Min Heap priority queue not work for anyone for D? It gives TLE for me. So is the solution using Fib Heap? Or is it some optimization issue?

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

Problem G is a template of Aho–Corasick algorithm.

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

Hello there!. Please help me with this submission why TLE!!

https://atcoder.jp/contests/abc362/submissions/55595549

»
22 месяца назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone please spot the mistake in my code for C question I am getting 2 Wrong answers rest all accepted.

My submission: https://atcoder.jp/contests/abc362/submissions/55602146

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

how come my O(n^5) code is running for problem e https://atcoder.jp/contests/abc362/submissions/55674291 I think it shouldn't... someone please correct me if i am wrongly calculating complexity or the constraints are just too loose

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

Can anyone explain me the approach Jinagly used for problem G. https://atcoder.jp/contests/abc362/submissions/55526066 What does the array fail indicate?