Submission #120494

#TimeUsernameProblemLanguageResultExecution timeMemory
120494_SamirCATS (NOI14_cats)C++17
0 / 25
180 ms2168 KiB
//https://github.com/mostafa-saad/MyCompetitiveProgramming/blob/master/Olympiad/MCO/official/2016/editorial.pdf #include<queue> #include<map> #include <string> #include<bits/stdc++.h> #define pi 3.141592654 #define forr(i,a,b) for(int i=a;i<=b;i++) #define F first #define S second #define input ios_base::sync_with_stdio(0);cin.tie(0); //#define x real() //#define y imag() using namespace std; typedef pair<double,double>pdd; typedef long long ll; typedef pair<ll, ll>pii; //typedef complex<double> point; //template<typename T>T gcd(T x, T y) { if(y == 0)return x; else return gcd(y, x%y); } //typedef bitset<30> mask; //int x[8]={1,0,0,-1,-1,-1,1,1}; //int y[8]={0,1,-1,0,-1,1,-1,1}; //#define var(x) ((x)<<1) //#define nvar(x) ((x)^1) const int N=100000,M=100000; ll n,x,l,q; main() { //cout<<Pow((ll)1000000,(ll)110); //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); // char input[15]; // scanf("%s", &input); array of char // gets(c+1); array of char //printf("%s, ",name[k[i]].c_str()); printf of string //priority_queue<ll,vector<ll>,greater<ll>>y; input; cin>>q; while(q--) { cin>>x>>l>>n; n*=2; ll g=(l+n-1)/n; ll t=g; g=g*n; if(((x+1)/2)%2) { if(t%2==1) { if(x%2)cout<<g<<endl; else cout<<g+1<<endl; } else { if(x%2)cout<<g+1<<endl; else cout<<g<<endl; } } else { if(t%2==1) { if(x%2)cout<<g+1<<endl; else cout<<g<<endl; } else { if(x%2)cout<<g<<endl; else cout<<g+1<<endl; } } } return 0; }

Compilation message (stderr)

cats.cpp:27:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
  main()
       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...