amsen's blog

By amsen, history, 2 weeks ago, In English

Hi all!

I was trying to understand tutorial for problem C and I think I find a mistake in it.

tutorial

In the third line it says Observe that flipping the direction of an odd cycle changes the sign of the permutation that is obviously wrong. for example in n = 3 and P = 2, 3, 1 when you flip the directions of edges P become 3, 1, 2 that has the same number of inversions(=2) and it can be proven that the parity of number of inversions depends only on number of cycles in permutation's graph.

I think the solution is not the way that described in tutorial because tutorial's answer for a triangle is zero but AC solutions print 2 for triangle that is correct.

Can anyone or ko_osaga explain solution or the tutorial?

thanks.

Read more »

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

By amsen, history, 4 years ago, In English

Does any body knows why SGU(acm.sgu.ru) is not working? it is about 2 days that i know!

Read more »

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

By amsen, history, 4 years ago, In English

Here are iran's team for IOI 2016 (russia) sorted by rating.

1- Ali Bahjati LiTi (last year gold medal)

2- AmirMohammad Dehghan amd

3- Arash Mahmoudian Reyna

4- SeyedParsa Mirtaheri SeyedParsa

thanks.

UPD: results:

1-Ali Bahjati — Gold Medal (rank 11)

2-Arash Mahmoudian — Gold Medal (rank 13)

3-AmirMohammad Dehghan — Silver Medal (rank 31)

4-SeyedParsa Mirtaheri — Silver Medal (rank 54)

Read more »

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

By amsen, history, 5 years ago, In English

I see lots of problems about cout/cin , most of them are telling that cin/cout are slow and it's better to use scanf/printf;

but cin/cout are prettier and more easy to code for c++ coders. so i try to make an IO that it's pretty and fast.


#include <bits/stdc++.h> using namespace std; class FastIO{ public: //Output operators : inline FastIO & operator << (const int &a){ printf("%d" , a); return *this; } inline FastIO & operator << (const long long &a){ printf("%I64d" , a); return *this; } inline FastIO & operator << (const double &a){ printf("%.9f" , a); return *this; } inline FastIO & operator << (const long double &a){ printf("%.9lf" , a); return *this; } inline FastIO & operator << (const char * const&a){ printf("%s" , a); return *this; } inline FastIO & operator << (const string &a){ printf("%s" , a.c_str()); return *this; } //Input operators : inline FastIO & operator >> (int &a){ scanf("%d" , &a); return *this; } inline FastIO & operator >> (long long &a){ scanf("%I64d" , &a); return *this; } inline FastIO & operator >> (double &a){ scanf("%lf" , &a); return *this; } inline FastIO & operator >> (long double &a){ scanf("%lf" , &a); return *this; } inline FastIO & operator >> (char * const&a){ scanf("%s" , a); return *this; } }fastIO;//you can change it to cin/cout int main(){ int a;long long b;double c; fastIO >> a >> b >> c << a << " , " << b << " , " << c << "\n"; }

Read more »

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

By amsen, history, 5 years ago, In English

How to become strong and expert in DP ?

can any body tell me some problems and some links to read ?

thanks all!

Read more »

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