Medeali's blog

By Medeali, history, 9 months ago, In English

i was solving this problem and i got WAbut i am very confused why it said 29th number in testcases https://codeforces.com/contest/1849/problem/B i wrote a program to stop accepting at 29th numbers testcase to spot it but when i tried it had right ouput can you help here's my code https://www.ideone.com/v0tCla i even checked the editorial and i found the same idea as mine but still don't know why WA please help

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

»
9 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Medeali (previous revision, new revision, compare).

»
9 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Your link to submission is missing, here it is 219842767. Something I noticed that that is different from my 215937048 submission, is the different comparison function which takes into account the index also but im not sure thats the issue.

bool comp(const vector<ll>& vec1, const vector<ll>& vec2){
	if (vec1[1] == vec2[1])
	{
		return vec1[0] < vec2[0];
	}
	return vec1[1] > vec2[1];
}
  • »
    »
    9 months ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    i don't think so since if the comparison was not taking into consideration index i would have gotten WA for sample input testcases besides i still cannot spot the wrong test the judge said 29th numbers but i tested them and it was fine As for the difference between our comparisons i think it is because i used atruct while you used vectors Edit: i solved the problem i had issue with both mod when mod was 0 i should have given value k to number and also with sort considering the index thanks a lot

»
9 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Medeali (previous revision, new revision, compare).

»
9 months ago, # |
  Vote: I like it 0 Vote: I do not like it

After few changes to your code it finally works AC

1. Comp function

From
To

2. Main logic

From
To
  • »
    »
    9 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thanks but already solved my issues and you were right about it i had two issues with both the logic and the compare