Submission #1551913


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1120000000
#define ll __int128

int main(){
  long y,m;
  cin>>y>>m;

  ll elapsed = (y-2013)*12 + m;

  ll l = 2012, r = y+1;
  while(r-l>1){
    ll mid = (l+r)/2;

    if( (mid-2012)*(mid-2000 + 13) / 2 <= elapsed ) l = mid;
    else r = mid;
  }

  long Y = l+1;
  long M = (elapsed - (l-2012)*(l-2000 + 13) / 2);
  if(M==0){
    Y--;
    M = Y - 2000;
  }
  assert(Y-2000 >= M);

  cout << Y << " " << M << endl;

  return 0;
}

Submission Info

Submission Time
Task B - 13月
User tossy
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1391 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Small Large
Score / Max Score 50 / 50 50 / 50
Status
AC × 19
AC × 35
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 1 ms 256 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