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

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

অদ্ভুত coders of Codeforces!!! (অদ্ভুত is a commonly used word in KUET meaning amazing)

We are thrilled to invite you to to participate in Replay of Ostad Presents Intra KUET Programming Contest 2023 which will be held on Tuesday, October 10,2023 at 19:00 (UTC+6).

You will have 5 hours to solve 13 problems. It is a beginner friendly contest. Teams preferred.

Thanks to the setters and testers of the contest: Mohaimin66, RUDRA_DAS, Likhon5, AngryBaymax, BrehamPie, Arnob, MinhazIbnMizan, weavile, Parvej, Noctambulant, Sabbir1807070, ShorifulSoumic, NM_Mehedy, Emon72, Creeping_Death_, brute__force__, _return_void_, Rafi, UmSuperNoob.

We hope you will enjoy the problemset.

UPD: Editorial

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

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

There's a typing mistake. It will be "Tuesday, October 10,2023"

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

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

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

I can't see any register button

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

How to solve problem I???

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

    Put 'a' on every leaf and 'b' on every non-leaf or vice versa. It was out solution but it is not correct. You can create more optimal solutions using other characters. And I have no idea how to solve it. One case where our solution fails:

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

Will we get any editorial?

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

    Unfortunately no, You can ask for solution ideas of some particular problem here, We'll try respond.

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

    Editorial of the contest has been posted. Check it out.

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

      #include<bits/stdc++.h> using namespace std; #define pi acos(-1.0) pair< double, double> rot(pair< double, double> i, double theta) { return {i.first*cos(theta)+i.second*sin(theta),-i.first*sin(theta)+i.second*cos(theta)}; } int main() { int t; cin>>t; while(t--) { long long a,b,m,n,theta; cin>>a>>b>>m>>n>>theta; vector<pair< double, double>>pp; long long g=gcd(m,n); m/=g; n/=g; pp.emplace_back(0,0); pp.emplace_back(b,0); pp.emplace_back(b,a); pp.emplace_back(0,a); for(auto &i:pp) { i=rot(i,pi*theta/180.0); } double d1=1e10, d2=1e10; for(auto i:pp) { d1=min(d1,i.first); d2=min(d2,i.second); } double wd=0,hd=0; for(auto &i:pp) { i.first-=d1; i.second-=d2; wd=max(i.first,wd); hd=max(i.second,hd); } long long lo=0,hi=1e10,ans=0; while(lo<=hi) { long long mi=(lo+hi)/2; long long w=n*mi,h=m*mi; if(wd-w<=1e-6 and hd-h<=1e-6) { hi=mi-1; ans=mi; } else lo=mi+1; } cout<<m*ans<<" "<<n*ans<<endl; } return 0; }

      In the code above if eps>1e-6 i got an WA . And how someone possibly know that he will got an WA for that ?

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

Code of problem k is provided below can anyone tell me why it shows wrong answer on test 2 .i have observed if sum of digits is divisible by 3 then that number is divisibld by 3 .so i make an digits array then count number of subarrays having digitsum 3 .#include

include

include

using namespace std;

int solution(vector arr, int n, int k) { int ans = 0; map<int, int> map; map[0] = 1; int sum = 0; int rem = 0; for (int i = 0; i < n; i++) { sum += arr[i]; rem = sum % k; if (rem < 0) { rem += k; } if (map.find(rem) != map.end()) { ans += map[rem]; } map[rem]++; } return ans; }

int main() { int t; cin >> t; while(t--){ int m,n; cin >> m>>n; vectorarr(m); string str = to_string(n); // int arr[m]; for (int i = 0; i < m; i++) { arr[i]=str[i]-'0'; } int k; k=3; cout << solution(arr, m, k) << endl; } return 0; }

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

How to solve B ??

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

Update

Editorial of the contest will be posted soon.

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

include

include

include

using namespace std;

int solution(vector arr, int n, int k) { int ans = 0; map<int, int> mp; mp[0] = 1; int sum = 0; int rem = 0; for (int i = 0; i < n; i++) { sum += arr[i]; rem = sum % k; if (rem < 0) { rem += k; } if (mp.find(rem) != mp.end()) { ans += mp[rem]; } mp[rem]++; } return ans; }

int main() { // int t; int t; cin >> t; while(t--){ int m;string str; cin >> m>>str; vectorarr(m); // string str = to_string(n); // int arr[m]; for (int i = 0; i < m; i++) { arr[i]=str[i]-'0'; } int k; k=3; cout << solution(arr, m, k) << endl; } return 0; }

NOW I HAVE DONE IT CORRECTLY IN O(M) STILL I GOT TLE

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

    std::ios::sync_with_stdio(false); std::cin.tie(nullptr);

    type this in the main function before the input

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

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

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

Arnob Brother, in L. not-incomplete question, why x constraint in 12 to 14?

question link: https://codeforces.com/gym/104663/problem/L?fbclid=IwAR3ZRc0KoevcYUKfBj2CT8GCs1kCBvxSsvfzXzGn6xo8jUCP_tK1o8IWTJI

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

    We tried to keep it realistic. Each semester normally consists of 12 to 14 weeks.