For this task:1805E - There Should Be a Lot of Maximums
This submission passed:318633319
This submission also passed: 318874332
Here is a testcase where their outputs differ (the first submission outputs a wrong answer)
For this task:1805E - There Should Be a Lot of Maximums
This submission passed:318633319
This submission also passed: 318874332
Here is a testcase where their outputs differ (the first submission outputs a wrong answer)
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define inf INT_MAX
#define ll long long
#define mod 1000000007
map<ll,pair<ll,ll>> m;
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll n,x; cin>>n>>x;
ll a[n];
for(int i=0;i<n;i++){
cin>>a[i];
m[a[i]].first++;
m[a[i]].second=i+1;
}
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
ll req=x-(a[i]+a[j]),h=m[req].first;
if(req==a[i] && req==a[j] && h>=3){
cout<<i+1<<" "<<j+1<<" "<<m[req].second;
return 0;
}
else if((req==a[i] || req==a[j]) && !(req==a[i] && req==a[j]) && h>=2){
cout<<i+1<<" "<<j+1<<" "<<m[req].second;
return 0;
}
else if((req!=a[i] && req!=a[j]) && h>=1){
cout<<i+1<<" "<<j+1<<" "<<m[req].second;
return 0;
}
}
}
cout<<"IMPOSSIBLE";
}
The complexity is O(n^2/2*logN) considering that N is up to 5000 the complexity would be 10^8*1.5 which is enough for 1 second. I also do simple operations like addition and subtraction.
Hello Codeforces I tried submitting my code for the problem A1. Gardener and the Capybaras (easy version) in the contest:Codeforces Round #843 (Div 2) and it said that the output was wrong for test case 1. Heres test case 1:bbba. My output: bb b a. What the Codeforces Judge says: wrong answer Ordering constrains were violated (test case 1). I'm sure that my output satisfies this condition: b≤a and b≤c. Is there something I missed because I read the problem a couple times and cant find any thing related to why my output would be wrong.