Codeforces Round #412 (rated, Div. 1, based on VK Cup 2017 Round 3), problem: (F) Test Data Generation, Accepted Solution In C/C++

By |2017-07-24T02:44:29+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , , |

#include<bits/stdc++.h> #define ll long long ll multmod(ll a, ll b, ll moder){ a = (a % moder + moder) % moder, b = (b % moder + moder) % moder; ll ret = 0; for ( ; b; b >>= 1){ if (b & [...]

Codeforces Round #412 (rated, Div. 1, based on VK Cup 2017 Round 3), problem: (E) Blog Post Rating Solution In JAVA

By |2017-07-24T02:42:50+00:00July 24th, 2017|Categories: Java, Programming|Tags: , , , , , , |

import static java.lang.Double.parseDouble; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Math.min; import static java.lang.System.exit; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Random; import java.util.StringTokenizer; public class E { static BufferedReader in; static PrintWriter out; static StringTokenizer tok; static int [...]

Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3), problem: (F) Perishable Roads Solution In JAVA

By |2017-07-24T02:40:45+00:00July 24th, 2017|Categories: Java, Programming|Tags: , , , , , , , , , , |

import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class Div2_412F { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int numV = Integer.parseInt(reader.readLine()); long[][] [...]

Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3), problem: (E) Prairie Partition Solution In C/C++

By |2017-07-24T02:37:16+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , , |

#include<bits/stdc++.h> using namespace std; int n; long long a[100005]; int check(int x){ int i,j,res,ress,t,sum; long long A,AA; i=0;ress=0; for(j=0;j<60;j++){ A=(1LL<<j); res=0; for(;i<n;i++){ if(a[i]==A){ res++; } else if(a[i]<A){ ress++; } else break; } if(ress>x) return 0; if(x>res){ ress-=(x-res); if(ress<0) ress=0; x=res; } if(res>x) ress+=(res-x); } [...]

Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3), problem: (D) Dynamic Problem Scoring Solution In C/C++

By |2017-07-24T02:35:23+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , , |

#include<bits/stdc++.h> using namespace std; int a[150][150]; int cnt[10]; int n; int getsc(int id, bool f, int s) { if(a[f][id]==-1) return 0; int sum; if(a[0][id] == -1 || a[1][id] == -1 || a[0][id]<a[1][id]) sum = cnt[id]; else sum = cnt[id]+s; int sc = 500; for(int [...]

Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3), problem: (B) T-Shirt Hunt Solution In C/C++

By |2017-07-24T02:31:32+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , , |

#include <bits/stdc++.h> using namespace std; int p,x,y,i; int luc(int s){ s = (s/50)%475; for (int i=0;i<25;i++) if((s=(s*96+42)%475)+26==p)return 1; return 0; } int main(){ cin>>p>>x>>y; for(i=x%50;!luc(i)||i<y;i+=50){} return cout<<(i<=x?0:(i-x+99)/100),0; }

Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3), problem: (A) Is it rated? Solution In C/C++

By |2017-07-24T02:30:01+00:00July 24th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , , , |

#include <iostream> using namespace std; int n,i,a,a1,b,f; string s[3]={"maybe","unrated","rated"}; int main(){ cin>>n; for(;i<n;i++){ cin>>a>>b; if(a!=b){f=2;break;} if(i>0&&a>a1)f=1; a1=a; } cout<<s[f]; }