結果

問題 No.112 ややこしい鶴亀算
ユーザー nenuon
提出日時 2017-06-29 13:26:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 644 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 89,116 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-04 16:34:59
合計ジャッジ時間 1,560 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;
int main(){
  // x - > つる, y - > かめ
  int N;
  cin >> N;
  int X = 0, Y = 0;
  FOR (i,0,N) {
    int a;
    cin >> a;
    int x = 2 * N - 2 - a / 2;
    int y = N - 1 - x;
    X = max(X, x);
    Y = max(Y, y);
  }
  if(X == 0) Y++;
  if(Y == 0) X++;
  printf("%d %d\n", X, Y);
  return 0;
}
0