Submission #2269612
Source Code Expand
#include<bits/stdc++.h> using namespace std; using Int = __int128_t; Int abs128(Int val){return val<0?-val:val;} ostream &operator<<(ostream &os,Int val){ if(ostream::sentry(os)){ __uint128_t tmp=abs128(val); char buf[64]; char *d=end(buf); do{ --d; *d=char(tmp%10+'0'); tmp/=10; }while(tmp); if(val<0) *--d='-'; Int len=end(buf)-d; if(os.rdbuf()->sputn(d,len)!=len){ os.setstate(ios_base::badbit); } } return os; } istream &operator>>(istream &is,Int &val){ string s; is>>s; val=0; for(Int i=0;i<(Int)s.size();i++) if(isdigit(s[i])) val=val*10+s[i]-'0'; if(s[0]=='-') val*=-1; return is; } //INSERT ABOVE HERE signed main(){ Int y,m; cin>>y>>m; Int x=(y-2013)*12+m; Int l=0,r=1e18; while(l+1<r){ Int m=(l+r)>>1; Int s=13*m+m*(m-1)/2; //cout<<m<<":"<<x<<" "<<s<<endl; if(s<x) l=m; else r=m; } Int n=l; Int s=13*n+n*(n-1)/2; x-=s; //cout<<n<<":"<<x<<endl; cout<<2013+n<<" "<<x<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - 13月 |
User | beet |
Language | C++14 (GCC 5.4.1) |
Score | 100 |
Code Size | 1082 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 384 KB |
Judge Result
Set Name | Small | Large | ||||
---|---|---|---|---|---|---|
Score / Max Score | 50 / 50 | 50 / 50 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Small | 01-max-small, 01-random-small01, 01-random-small02, 01-random-small03, 01-random-small04, 01-random-small05, 01-random-small06, 01-random-small07, 01-random-small08, 01-random-small09, 01-random-small10, 01-random-small11, 01-random-small12, 01-random-small13, 01-random-small14, 01-random-small15, 00-sample1, 00-sample2, 00-sample3 |
Large | 00-sample1, 00-sample2, 00-sample3, 01-max-small, 01-random-small01, 01-random-small02, 01-random-small03, 01-random-small04, 01-random-small05, 01-random-small06, 01-random-small07, 01-random-small08, 01-random-small09, 01-random-small10, 01-random-small11, 01-random-small12, 01-random-small13, 01-random-small14, 01-random-small15, 10-max-large, 11-random-large01, 11-random-large02, 11-random-large03, 11-random-large04, 11-random-large05, 11-random-large06, 11-random-large07, 11-random-large08, 11-random-large09, 11-random-large10, 11-random-large11, 11-random-large12, 11-random-large13, 11-random-large14, 11-random-large15 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00-sample1 | AC | 2 ms | 384 KB |
00-sample2 | AC | 1 ms | 256 KB |
00-sample3 | AC | 1 ms | 256 KB |
01-max-small | AC | 1 ms | 256 KB |
01-random-small01 | AC | 1 ms | 256 KB |
01-random-small02 | AC | 1 ms | 256 KB |
01-random-small03 | AC | 1 ms | 256 KB |
01-random-small04 | AC | 1 ms | 256 KB |
01-random-small05 | AC | 1 ms | 256 KB |
01-random-small06 | AC | 1 ms | 256 KB |
01-random-small07 | AC | 1 ms | 256 KB |
01-random-small08 | AC | 1 ms | 256 KB |
01-random-small09 | AC | 1 ms | 256 KB |
01-random-small10 | AC | 1 ms | 256 KB |
01-random-small11 | AC | 1 ms | 256 KB |
01-random-small12 | AC | 1 ms | 256 KB |
01-random-small13 | AC | 1 ms | 256 KB |
01-random-small14 | AC | 1 ms | 256 KB |
01-random-small15 | AC | 1 ms | 256 KB |
10-max-large | AC | 1 ms | 256 KB |
11-random-large01 | AC | 1 ms | 256 KB |
11-random-large02 | AC | 1 ms | 256 KB |
11-random-large03 | AC | 1 ms | 256 KB |
11-random-large04 | AC | 1 ms | 256 KB |
11-random-large05 | AC | 1 ms | 256 KB |
11-random-large06 | AC | 1 ms | 256 KB |
11-random-large07 | AC | 1 ms | 256 KB |
11-random-large08 | AC | 1 ms | 256 KB |
11-random-large09 | AC | 1 ms | 256 KB |
11-random-large10 | AC | 1 ms | 256 KB |
11-random-large11 | AC | 1 ms | 256 KB |
11-random-large12 | AC | 1 ms | 256 KB |
11-random-large13 | AC | 1 ms | 256 KB |
11-random-large14 | AC | 1 ms | 256 KB |
11-random-large15 | AC | 1 ms | 256 KB |