Seferoglu's blog

By Seferoglu, history, 7 months ago, In English

Good evening CodeForces,today I tried solving https://oj.uz/problem/view/JOI16_selling_rna. My code has a very weird behaviour. To start, compiling in C++20 takes so long that I guess oj.uz marks it as compilation error. The same code gets AC in C++17 (and compiles instantly on my machine). See here:

https://oj.uz/submission/1277541

https://oj.uz/submission/1277540

Another weird behavior I encountered while implementing is if you switch the vector ids; with set ids; in the Node struct, and change the push_back's with insert's, it causes an infinite loop I wasn't able to put my finger on. Also if one compiles the set solution with glibcxx, the following error message is produced (which I'm unable to use to my advantage)

Spoiler

Please help me since I had a similar problem with c++20 before at an important exam (I had compilation TLE on cms on a very simple code which I dont have access to rn)

Full text and comments »

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

By Seferoglu, history, 8 months ago, In English

Hello CodeForces, tonight we mourn the sad demise of a man who once was a legend, truly an icon in the Turkish CP community. That man is AhmetKaan Avcı. Let me tell you the sad, disgusting story of how he became who he is and what has yet to happen to him.

Our story begins in 2004, just two days ago in September 19th. Born in Kastamonu/Türkiye to a family of 6 children, a family that posseses one IMO participant (Ömer Avcı), and one older brother who once dominated Turkish Olympiad programming. (farukkastamonuda orz) This man was obviously blessed with inspiration from an abundance of role models inside his own home. Even though genetics seemed to be to his advantage, he always lacked the skill to even do simple math. He cried his nights yearning to become like his elite brothers. It just didn't come natural to him, ever.

His prayers were answered and his older brother Faruk came back home from his highschool outside Konya, and trained him all day, he was such an amazing teacher, training such a garbage student to pass the first stage of Junior Informatics Olympiads with flying colors (first place). Having good programming xp once again owing to his brother, he absolutely crushed the empty empty battlefield of Junior Olympiads in Türkiye, making way to his first international olympiad, EJOI 2019, where he gained a Bronze medal. Just then from a young age, this man seemed promising, who could have guessed the insane disappointment that was yet to take place.

https://mirror.codeforces.com/blog/entry/120487 (Refer here for more info on his awesome family and nice photos)

The year 2020 has arrived. The time had come when Ahmet Kaan was going to participate in an high school level competition for the first time in his life. It was a stunning upset and he earned a silver medal on his first senior NOI. It was a staggering success, not only had he emerged victorious on his first year, he managed to gain a silver medal which many fail to earn throughout their entire olympiad careers. Times were good and everything was looking up for Ahmet Kaan. He had 2 more attempts and he was just getting started. His first Team Selection Test took place that year too, and once again he didn't fail to surprise with an amazing result, taking 5th place on his first attempt. He was just one spot away from going to IOI, his lifelong goal.

It was here that things started going downhill. Not only did he fail to get gold medals on his 2 other NOI attempts, he also failed to make it to IOI with slim margins and some tough luck. On the 2021 TST, one of the authors hacked his solution by adding additional tests to CMS and didn't even inform him of the incident. He finished his exam feeling like a champion, just to learn that 70 precious points were taken away from him. This will obviously go down as one of the worst scandals in Turkish Olympiad history but nothing could be done. On his next year since he was a senior now, he had to study for the ridiculously competitive memorisation based Turkish university admission exam system, YKS. And with this handicap and a stupid suffix array problem's apperance at TST, he once again failed, completing his high school olympiad career with 3 silver medals and one 5th place rank on TST. Things didn't go well for him on YKS either, he didn't manage to get in a very good public university and had to resort to a local private university that offers full scholarship to national silver and gold medalists.

Even though he hadn't made it to the national team, he stayed insanely passionate in competitive programming, training countless students (including me) throughout his university years, acting as a problemsetter and an instructor. Jokes aside he is without doubt one of the most passionate and helpful people in Türkiye and he has inspired so much people. He still attends team camps and regular training camps to this day.

The reason why I decided to write this blog is because of todays Div2 Round where he failed to solve D1 D2 and E. After nearly 8 years of studying cp, he has told us about his frustration of lacking behind his peers and his endless skill issue. He is very upset nowadays since he is having terrible contests although he feels like he is training hard. He was even spotted listening to https://www.youtube.com/watch?v=xc2Kp3igZ7A for hours on repeat.

We demand your best wishes for this man, Ahmet Kaan Avcı. We need some strong people to say some strong words that will cheer him up.

Thanks to Ahmet Kaan Avcı himself for all the information included in this blog too.

AHMET KAAN AVCI OTZ

Photos of us taken by our teammate after contest.

Full text and comments »

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

By Seferoglu, history, 12 months ago, In English

Hello CodeForces, today I tried solving an output-only problem for the first time but had lots of difficulties with bash scripting to create zips, direct input-output and stuff like that. I have always memorised the stress testing code from Errichto's amazing yt video on stress testing and since it is quite short it has served me well upto this point and so I never learned bash scripting. But now I really started thinking that I should learn it to solve output only problems. I'd like to hear your thoughts on the matter and get some nice links or resources.

Thanks for your attention

Full text and comments »

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

By Seferoglu, history, 12 months ago, In English

Hello Codeforces,

Yesterday marked the end of the Turkish TST. While the official results haven't been announced yet, I believe I've qualified for the national team.

Over the years, I've solved thousands of problems across various platforms. However, I’m aware that unlike many other Olympiads in Informatics, the IOI includes heuristic, output-only, and many interactive problems. I’ve also heard that since 2016, the IOI has shifted from being primarily algorithm/technique-heavy to featuring more ad-hoc and logic-based problems. As someone still relatively inexperienced with actual IOI tasks, I can neither confirm nor deny these claims.

Right now, I’m trying to figure out the best way to make use of the few months ahead. I’d truly appreciate any recommendations on high-quality IOI preparation resources. My goal is for this blog to serve as a cornerstone for IOI preparation—a place that brings together everything related to the IOI, and the IOI only.

Thank you for your interest!

Full text and comments »

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

By Seferoglu, history, 13 months ago, In English

Problem link

I implemented a fairly straightforward soln for this problem that is very similar to the editorial in essense. It uses bitsets and the main logic goes as follows:

As all ancestors for a node (lets say node a) are known when the node is first created, we can determine the nodes "b" for which a and b could form the middle part of a diamond. Whenever a new class is created, I first check if any pair of ancestors for the new class form such a couple (I denote below as "hate[][]"). If so this would create a diamond and we can terminate our search.

Otherwise I will proceed to calculate new such pairs having the new node as "a". I believe the impl is not too incomprehensible but I will be happy to answer questions. This code gets 27 points so I dont believe anything is wrong with the parsing. here is my submission code:

#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define vi vector<int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define sp << " " << 
using namespace std;

const int N =1e5+10,MOD = 1e9+7,inf = 2e9;

void solve() {
    int n;
    cin >> n;
    int nd = 0;
    bitset<1001> go[1001],come[1001],hate[1001],share;
    string trash;
    getline(cin,trash);
    map<string,int> mp;
    for (int i = 1;i<=n;i++) {
        string name,realname;
        getline(cin,name);
        string cur;
        int start = 0;
        vi pars;
        bool fl = 1;
        for (int j = 0;j<name.size();j++) {
            if (name[j] == ':') start = 1;
            if (!start && name[j] >= 'a' && name[j] <= 'z') realname+=name[j];
            if (start && name[j] >= 'a' && name[j] <= 'z') cur+=name[j];
            else {
                if (!cur.empty()) {
                    if (!mp.count(cur)) {
                        fl = 0;
                        break;
                    }
                    pars.push_back(mp[cur]);
                }
                cur.clear();
            }
        }
        if (!fl || mp[realname]) {
            cout << "greska" << endl;
            continue;
        }
        ++nd;
        come[nd].set(nd);
        go[nd].set(nd);
        for (auto it : pars) come[nd]|=come[it];
        for (int j = 1;j<nd && fl;j++) {
            if (!come[nd][j]) continue;
            for (int jj = j+1;jj<nd && fl;jj++) {
                if (come[nd][jj] && hate[j][jj]) {
                    fl = 0;
                    break;
                }
            }
        }
        if (!fl) {
            come[nd].reset();
            go[nd].reset();
            --nd;
            cout << "greska" << endl;
            continue; 
        }
        cout << "ok" << endl;
        for (int j = 1;j<nd;j++) {
            if (come[nd][j]) go[j][nd] = 1;
        }
        mp[realname] = nd;
        //cout << realname << " IS " << nd << '\n';
        share.reset();
        for (int j = 1;j<nd;j++){
            if (come[nd][j]) {
                share|=go[j];
            }
        }
        for (int j = 1;j<nd;j++) {
            if (share[j] && !go[j][nd]) {
                hate[nd][j] = hate[j][nd] = 1;
            }
        }
    }
} 

signed main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    #ifdef Dodi
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
    int t = 1;
    //cin >> t;
    while (t --> 0) solve();
} 

Full text and comments »

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

By Seferoglu, history, 13 months ago, In English

User Basmaci has just reached cyan after 4 months of learning cpp and practising hard! This is a very cool milestone towards hopefully making it to IOI 2027/28/29. Keep up the good work Basmaci!

Full text and comments »

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

By Seferoglu, history, 19 months ago, In English

Hello CodeForces, I am curious about how people tackle such problems but cant find resources (at least with a very brief google search). I would appreciate it if someone provided me with some.

Full text and comments »

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

By Seferoglu, history, 21 month(s) ago, In English

La Paz is clearly no place to host IOI. (It has already been talked about but I wanted to reignite the discussion.) https://mirror.codeforces.com/blog/entry/128667 by E869120 explains the issue thoroughly.

Full text and comments »

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

By Seferoglu, history, 21 month(s) ago, In English

This is the first time I see pdf editorials for a round that is not for ICPC or similar contest. I love the format and just wanted to support the setters by writing this blog.

Full text and comments »

  • Vote: I like it
  • -19
  • Vote: I do not like it

By Seferoglu, history, 22 months ago, In English

Hello CodeForces, today I was solving the problem 1985H2 - Maximize the Largest Component (Hard Version) and implemented it with C++. It passes all the tests seperately but throws RE when I try to run multiple tests. I have been debugging for around half an hour but can't find the problem. I would appreciate any help. Here is my submission:268092158

PS: Local compiler also throws RE.

Full text and comments »

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

By Seferoglu, history, 23 months ago, In English

The submission is here: 265738238

I do not think that I use significant stack memory here, it is mostly heap memory. Also I have cloned to the mashup to test with 2GB memory limits and got exactly the same result.

The code is pretty clear in my opinion but I will be happy to clarify if asked.

Thanks for your interest.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Seferoglu, history, 2 years ago, In English

The only difference between the two submissions is using a lambda function vs a global function. Lambda functions made the runtime around 7 times slower.

What do you think this is because?

AC: 255501228

TLE: 255500672

so should we always prefer global functions over lambdas then?

Full text and comments »

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

By Seferoglu, history, 2 years ago, In English

Hello CodeForces, today I tried solving the problem from a recent contest: 1923E - Count Paths

My Solution:

Solution

If you see any problems with the code, please let me know as I can't see the problem. If you don't understand a part of the code, please ask and I will clarify.

Submission: 255437477

UPD: The runtime takes more than 30 seconds! So I guess the runtime is O(N^2) somehow.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it