Codeforces Round #515 (Div. 3)
1#include <bits/stdc++.h>2#include <iostream>3#include <cstdio>4#include <cstdlib>5#include <cstring>6#include <cmath>7#include <algorithm>8#include <queue>9#include <vector>Ten#include <map> One #defineLson i<<1 A #defineRson i<<1|1 - #defineLS L,mid,lson - #defineRS Mid+1,r,rson the #defineMem (a,x) memset (A,x,sizeof (a)) - #defineGCD (A, B) __gcd (A, B) - #definell Long Long - #defineull unsigned long Long + #defineLowbit (x) (x&-x) - #definePB (x) push_back (x) + #defineENLD Endl A #defineMian Main at #defineITN int - #definePrinft printf - #pragmaGCC Optimize (2) - //#pragma COMMENT (linker, "/stack:102400000,102400000") - - Const DoublePI = ACOs (-1.0); in Const intINF =0x3f3f3f3f; - Const intEXP = 1e-8; to Const intN = 1e5 +5; + Const intMOD = 1e9 +7; - Const intMAXN =505; the * using namespacestd; $ Panax Notoginseng /* - 4 the Ten 2 3 7 + the A 1234 1 199 the 1000000000 1 1 1000000000 + */ - intN,l,v,l,r; $ intMain () { $Std::ios::sync_with_stdio (false); - Cin.tie (NULL); - the while(cin>>N) { - while(n--) {WuyiCin>>l>>v>>l>>R; thecout<<l/v-(r/v-(l1)/V) <<Endl; - } Wu } -}
A-vova and Train
1#include <bits/stdc++.h>2#include <iostream>3#include <cstdio>4#include <cstdlib>5#include <cstring>6#include <cmath>7#include <algorithm>8#include <queue>9#include <vector>Ten#include <map> One #defineLson i<<1 A #defineRson i<<1|1 - #defineLS L,mid,lson - #defineRS Mid+1,r,rson the #defineMem (a,x) memset (A,x,sizeof (a)) - #defineGCD (A, B) __gcd (A, B) - #definell Long Long - #defineull unsigned long Long + #defineLowbit (x) (x&-x) - #definePB (x) push_back (x) + #defineENLD Endl A #defineMian Main at #defineITN int - #definePrinft printf - #pragmaGCC Optimize (2) - //#pragma COMMENT (linker, "/stack:102400000,102400000") - - Const DoublePI = ACOs (-1.0); in Const intINF =0x3f3f3f3f; - Const intEXP = 1e-8; to Const intN = 1e5 +5; + Const intMOD = 1e9 +7; - Const intMAXN = 2e5+5; the * using namespacestd; $ Panax Notoginseng /* - 8 the L 1 + R 2 A R 3 the ? 2 + L 4 - ? 1 $ L 5 $ ? 1 - */ - intN; the CharC; - intIND;Wuyi intA[MAXN]; the intMain () { - //Std::ios::sync_with_stdio (false); Wu //Cin.tie (NULL); - About while(cin>>N) { $ intL=0, r=1; -Mem (A,0); - while(n--) { -Cin>>c>>IND; A if(c=='L') { +a[ind]=l--; the}Else if(c=='R') { -a[ind]=r++; $}Else { the //cout<<a[ind]<< ' <<a[l+1]<< ' <<l+1<<endl; theCout<<min (a[ind]-(l +1), R1-a[ind]) <<Endl; the } the } - in } the}
c-books Queries
Codeforces Round #515 (Div. 3)