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

Автор cry, 2 года назад, По-английски

Welcome to Natlan, Codeforces!

sum, Proof_by_QED and I are like a dog with two tails to welcome you to participate in Codeforces Round 988 (Div. 3) at Nov/17/2024 17:35 (Moscow time). We have cooked up $$$7$$$ problems to be solved in $$$2$$$ hours and $$$15$$$ minutes.

The round will be hosted by rules of educational rounds (extended ICPC). Thus, solutions will be judged on preliminary tests during the round, and after the round, it will be a 12-hour phase of open hacks. After open hacks all accepted solutions will be rejudged on successful hacks.

Note that the penalty for each wrong submission in this round is 10 minutes. Also, note the rule restricting AI use!!! If you are caught using AI in an unorthodox manner, bad things will happen to you. We will be watching you all...

IMPORTANT!!! There is at least one interactive problem in the problemset. Please familiarize yourself with the guide for interactive problems beforehand.

Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behavior. To qualify as a trusted participant of the third division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them)
  • do not have a rating of 1900 or higher at any moment in time.

Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you (unless you register unrated).

We would like to orz the following individuals for making the contest possible:

UPD: Editorial!!!

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

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

Let's just pretend that Natlan didn't come out two months ago.

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

As a writer, I welcome you to Natlan with open arms

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

As a tester.... Visit a local Scientology center, attend a free seminar, or take a personality test and find out how Scientology can support you on your journey. Awaken your true self and step into a world of possibility — Your path to a better life starts here!!!

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

As a tester, I have been wondering who Natlan was.

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

As a tester, I just learnt that this round is Genshin themed (I don't play Genshin)

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

As a tester, I recommend the round — it is excellent.

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

As a tester, I think this will be the best Div3 ever. Enjoy it!

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

tester As ! , love std::shuffle I a

fun also problems The were ! very

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

do not have a point of 1900 or higher in the rating.

Is it a typo?

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

As a tester, I need to google Natlan.

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

As a tester, the problem are great. Have fun and good luck

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

As a VIP tester, I can guarantee you that the tasks are tasks.

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

As a tester: Genshin, Activate!

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

I think this is the coolest contest announcement I've seen recently.

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

as a genshin hater, I'm looking forward to hopefully gaining quite a lot of rate change in this contest

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

[deleted]

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

Oh, its time crashs with my Ragional Contest of ICPC, Shanghai Station! I'm now in mihoyo's HQ, wishing every participants good luck and high rating! And wish me to win a medal :) By the way, Genshin? Launch!

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

i hope this div3 doesn't have as trash testcases as the last one.

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

As a genshin player, I hope this will be a good round.

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

The arrogation of mankind ends now.

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

genshin mentioned

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

I love you for the Gwnshin reference❤️

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

ZaDiv3

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

well exactly we have a natlan contest before gta VI

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

The picture in the post brings back memories of the song "Close to the Sun" by TheFatRat. It takes me right back to high school days, when the line between passing time and wasting it was just a little blurrier.

Feel free to give it a listen if you're in the mood: https://www.youtube.com/watch?v=oJuGlqO85YI

Thanks for the nostalgia boost!

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

I will eat shit if I can't become Expert after this contest.

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

YuanShen

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

It should be "at most one" interactive problem for any div3 or div4 contests. There is absolutely no value in learning these kind of problems for lower rated participants. It brings "joy" only for higher rated contestants who got bored at some point and invented a "new kind of fun". Do you think it's fun for newbies to solve these kind of problems? They have enough problems just to come up with any solutions at all :D

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

    They don't want to spoil the number of interactive problems, but rather the fact that it will be used so people who don't know how to solve them can look at the interactive guide. Hence the "at least one" statement was used.

    Even in Div 2/1 it's not super common to see 2 interactive problems in a problemset.

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

Quick question, why are people with rating higher than 1900 not “trusted participants of the third division”?

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

Announcement: Welcome to Natlan! Actual contest: Welcome to Khaenri'ah! Hope it won't be the cataclysm for my rating.

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

Good luck in the contest!!!

But, what is a VIP tester?

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

Cannot turn it down as a player of Genshin Impact

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

It is Guaranteed that there will be no more than $$$N$$$ interactive problems.

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

Genshin is bad, i recommend that you need to touch grass after 3 years

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

It's been almost a year since I started doing CP seriously. Now my rating is 1361, hope to become specialist in this one.

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

I think participating in genshin impact round feels like being "GAY"

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

If I didn't perform well , I'll touch the grass.

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

i hate newbies

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

score distribution?

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

eagerly waited for Such cool Div3 (as a newbie). thank you !!!

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

As a participant, I bet atleast one problem is about Mualani!

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

I have an exam tomorrow, should I study or hit expert ?

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

As Genshin Impact player, I am pleasantly surprised. It's too good to be true.

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

IF I DON'T RETURN THAT DAMNED SPECIALIST, I SHALL RETURN THE NEWBIE

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

hoping for pupil this round

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

Well wishes to all

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

go to expert and candidate master

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

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

why problem D is in russian i only know french arabic and english should i learn russian to gain rating points and solve the problem ??? i am trying my best each contest to get any point and you guys came with russian language

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

As a Chinese, I wonder who Superultra is. Is it a user name?

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

Great E

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

this exactly what a div3 should be, great problems!

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

I thought that problem C was harder than D

anyway, ill finally get to pupil :D

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

    Personally, C was harder to notice the observation, but was really simple to write compared to D, which was an easy observation but more difficult to write

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

      I find that so interesting about codeforces contests. They are much more focused on the observation difficulty rather then "data structures/techniques" difficulty. Like sometimes I can't even solve Div 2B's (if it is a observation problem), when it seems that everyone here can, and on the other hand the same ppl dont know basics about heaps, graphs, segtrees, etc.

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

        That's what I like about codeforces, the questions (for the most part) aren't "do you know this random theorem or this random data structure", but require more thinking. Sure, there will be some insanely standard questions (such as Ruler — easy version or A good string) that require little thinking outside of knowing an algorithm, but for the most part, the questions are unique and fun to solve.

        Only annoying part about that is difficulty feels a bit inconsistent, I'll be able to look at a 1400 and solve it immediately then struggle on a 1200 / 1300, but that's just how it is.

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

D solution Please

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

    store the power ups as you traverse, when a power boost is required use the biggest of the them.

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

    For each time we pick up an item, we definitely greedily select the one that provides the greatest improvement to our abilities among the items we can take but haven't yet collected.

    Therefore, we can use a heap to manage the items. We enumerate each obstacle, add all the items available before that obstacle to the heap, and then take items from the heap until we can jump over the obstacle.

    The code:

    #define l first
    #define r second
    
    #define ft first
    #define sd second
    
    void solve()
    {
        int n, m, L;
        cin >> n >> m >> L;
        vector<pair<int, int>> a(n + 1);
        for (int i = 1; i <= n; i++)
        {
            cin >> a[i].l >> a[i].r;
        }
        vector<pair<int, int>> b(m + 1);
        int ans = -1;
        for (int i = 1; i <= m; i++)
        {
            cin >> b[i].ft >> b[i].sd;
        }
        ll val = 1;
        int cnt = 0;
        int j = 1;
        priority_queue<int> q;
        for (int i = 1; i <= n; i++)
        {
            while (j <= m && b[j].ft < a[i].l)
            {
                q.push(b[j].sd);
                j++;
            }
            while (q.size() && val < a[i].r - a[i].l + 2)
            {
                val += q.top();
                cnt++;
                q.pop();
            }
            if (val < a[i].r - a[i].l + 2)
            {
                cout << "-1\n";
                return;
            }
        }
        cout << cnt << "\n";
    }
    
»
23 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to do D?

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

    For each time we pick up an item, we definitely greedily select the one that provides the greatest improvement to our abilities among the items we can take but haven't yet collected.

    Therefore, we can use a heap to manage the items. We enumerate each obstacle, add all the items available before that obstacle to the heap, and then take items from the heap until we can jump over the obstacle.

    The code:

    #define l first
    #define r second
    
    #define ft first
    #define sd second
    
    void solve()
    {
        int n, m, L;
        cin >> n >> m >> L;
        vector<pair<int, int>> a(n + 1);
        for (int i = 1; i <= n; i++)
        {
            cin >> a[i].l >> a[i].r;
        }
        vector<pair<int, int>> b(m + 1);
        int ans = -1;
        for (int i = 1; i <= m; i++)
        {
            cin >> b[i].ft >> b[i].sd;
        }
        ll val = 1;
        int cnt = 0;
        int j = 1;
        priority_queue<int> q;
        for (int i = 1; i <= n; i++)
        {
            while (j <= m && b[j].ft < a[i].l)
            {
                q.push(b[j].sd);
                j++;
            }
            while (q.size() && val < a[i].r - a[i].l + 2)
            {
                val += q.top();
                cnt++;
                q.pop();
            }
            if (val < a[i].r - a[i].l + 2)
            {
                cout << "-1\n";
                return;
            }
        }
        cout << cnt << "\n";
    }
    
»
23 месяца назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

tourist wtf?? How does one complete problem E in 1 min??

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

I think it was a nice set of problems. I struggled in trying to figure out where I was going wrong with E ... genuinely losing my mind. I don't think there's a problem with my idea/proof, but just maybe something small in the implementation... :(

UPD: Well, since the editorial is posted, I suppose I might as well explain my thinking for E:

  • IMPOSSIBLE if and only if there exists no "01" substring, which is equal to querying the entire string and getting an answer of 0.

  • Otherwise, there is some "01", and we start querying all the prefixes [1, 2], [1, 3] ... [1, n]. Suppose the first one to give a non-zero answer is [1, i]. Let that answer be R. Then, since all prefixes before [1, i] gave 0 as an answer, the string over [0, i-1] is i-1-R 1's followed by R 0's. Also s[i] must be 1. To determine the suffix s[i+1, n], we query over the prefixes still [1, i+1], [1, i+2] ... [1, n], and, at each query, if the answer increases from the previous one, we have a 1 there, otherwise it is 0 there. In total, we take exactly 1 query for each char in s[2, n], meaning we require n-1 queries.

Does anyone know if there is something wrong here?

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

    i think it's correct

    UPD: i think your implementation should have used long long. you took input as an integer, which can overflow and made the condition (r1 > prev) false.

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

      No, I redefined int to be long long. The issue was actually that "interQuery" function returned a god damn char instead of int by accident. :(((

      (Also the biggest number to be dealt with in this problem is on the order of (10^4)^2 = 10^8, so there is actually no need for long long anyways).

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

anyone who solved last problem, please teach me new things

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

In problem D, after the problem statement changed, still wrong. Or am I high?

In the second test case, she cannot jump over the first hurdle.

Actually it's the third hurdle that she cannot jump... I debugged my code for this.

UPD: Now I noticed she also cannot jump over the first hurdle, I'm actually high.

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

how to optimize G my solution is $$$O(n * k ^ 2)$$$
where $$$k$$$ is max no. of factors

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

it's silly G was ChatGPT solvable, I'd review all submission of G among rated participant if I were coordinator.

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

Somebody hack my solution for B. If k - 2 is a perfect square and its root is x, we should check if we have 2 x's in the multiset right? I did not do that.

Like example [2, 1, 1, 1, 1, 1] my solution outputs 2 2.

Submission

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

Hello!

Can anyone help me with the idleness limit exceeded on this submission for question E

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

Can anyone please explain G in simple terms. thank you :)

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

Is tourist for real? y'all sure he is not an AI?

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

I enjoyed this contest :)

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

In problem D, shouldn't first test case be false instead of true? Need to jump from li-1 to ri+1 that is ri — li + 2. But the total power up that can be collected is 8 for the first hurdle and it is less than 9 that needed to be jumped from 6 15.

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

Inconsistent output for 2037 B. Intercepted Inputs https://codeforces.me/contest/2037/submission/292083626 Test case 1: 2 1 4 5 3 3 my output is shown as 2 2 but when I run it else anywhere (online and my machine) its giving 1 4. Can anyone help me understand what is going wrong here?

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

292066305 siliconrhino chatgpt obviously,this guy solve e,f,g in 10 minutes. get him get him :P

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

The G problem has an original problem, which is Problem J from the 2022 ICPC Guangxi Provincial Contest. You just need to modify the modulus and the range, and you can submit it directly to pass.
Link: https://pintia.cn/market/item/1541299013331705856

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

as a mualani main, D was cool but i couldn't surf through natlan and nice contest

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

Has rating changes been rolled out?

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

wc,yuan

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

Where is Editorial ?

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

Why is the Editorial!!! not allowed to view.

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

Can someone explain why i get idleness limit exceeded, this is not new, almost for every interactive problems. I tried deleting fast io, endl, \n, also in this code i make assertion. How it could be possible: my code

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

Why when I try to view the Editorial, it says 'You are not allowed to view the requested page'?

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

Can someone please explain the binary search approach for D ?

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

Looks like the editorial has been taken down. Please fix cry

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

Hi, can someone pls help me?

my rank in standing page says 1594 as rank, but on my profile, the rank of the contest says, 1905. Can someone help me understand why two different ranks?

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

    This part in the announcement explains it:

    "Remember that only the trusted participants of the third division will be included in the official standings table."

    "Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you (unless you register unrated)."

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

For D i don't get where this logic is wrong? For every hurdle i just checked whats the minimum number of jump boosters i need to take .. for that i took a set where i stored the power ups taken after the last hurdle to the initial hurdle i am on ... And a priority queue where i stored the power ups i didn't take from the beginning to the current hurdle i need to pass. My tar for every hurdle is the amount of jump power i need — sum(the jump power i have).. when my tar becomes less than 0 i check how many power ups i could initially not take that is in the set that's why cnt--.. after taking all the power ups before a certain hurdle if my tar is greater than 0 then i just take the power ups in the priority queue untill my tar becomes less than 0 and do cnt++.. if it cant then i do flag =1 and print -1 later on. Heres my code https://codeforces.me/contest/2037/submission/292074400

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

why is editorial not available?

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

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

code giving correct answer in code editor but codeforces judge giving this error :wrong answer Integer parameter [name=r] equals to 5, violates the range [6, 5] (test case 1) can you some tell why this happening ~~~~~ void solve() { int n; cin >> n;

auto ask = [&](int l, int r)
{
    int x;
    cout << "? " << l << " " << r << endl;
    cin >> x;
    return x;
};
string ans = "";
int value = ask(1, n);

if (!value)
{
    cout << "! " << "IMPOSSIBLE" << endl;
    return;
}
else
{
    int l = 2;

    while (l <= n)
    {
        int x = ask(l, n);

        if (x == value)
            ans += '1';
        else
            ans += '0';

        value = x;
        if (!x)
            break;
        l++;
    }

    for (int j = l; j <= n; j++)
    {
        ans += '1';
    }

    cout << "! " << ans << endl;
    return;
}

}

int main() { int t; cin >> t; while (t--) { solve(); } return 0; } ~~~~~