QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#169274#7183. Passworducup-team859#AC ✓44ms57876kbC++143.7kb2023-09-09 13:16:542023-09-09 13:16:59

Judging History

你现在查看的是最新测评结果

  • [2023-09-09 13:16:59]
  • 评测
  • 测评结果:AC
  • 用时:44ms
  • 内存:57876kb
  • [2023-09-09 13:16:54]
  • 提交

answer

// C++ includes used for precompiling -*- C++ -*-

// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.

// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.

// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>.

/** @file stdc++.h
 *  This is an implementation file for a precompiled header.
 */

// Also writing "using namespace std;" here so that you dont need to write it everytime you start a cpp file

using namespace std;


// 17.4.1.2 Headers

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

#define lsb(x) (x & (-x))

using ull = unsigned long long;
using ll = long long;

using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int n;
    cin >> n;

    vector<vector<int>> mn(n + 1, vector<int>(3, 100000000));

    mn[0][0] = 0;
    for (int i = 1; i <= n; ++i) {
        
        if (!((n % 2 == 0 && (i == n / 2 || i == n / 2 + 1)) || (n % 2 == 1 && i == n / 2 + 1))) {
            for (int j = 1; j <= 2; ++j) {
                mn[i][j] = min(mn[i - 1][j - 1], mn[i][j]);
            }
        }

        mn[i][0] = min(min(mn[i - 1][0], mn[i - 1][1]), mn[i - 1][2]) + 1;
    }

    int x = min({mn[n][0], mn[n][1], mn[n][2]});
    cout << x << " " << n << "\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3848kb

input:

1

output:

1 1

result:

ok single line: '1 1'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

2

output:

2 2

result:

ok single line: '2 2'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

3

output:

1 3

result:

ok single line: '1 3'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3552kb

input:

10

output:

4 10

result:

ok single line: '4 10'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

5

output:

1 5

result:

ok single line: '1 5'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

6

output:

2 6

result:

ok single line: '2 6'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

7

output:

3 7

result:

ok single line: '3 7'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

8

output:

4 8

result:

ok single line: '4 8'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

9

output:

3 9

result:

ok single line: '3 9'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3444kb

input:

4

output:

2 4

result:

ok single line: '2 4'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3908kb

input:

9484

output:

3162 9484

result:

ok single line: '3162 9484'

Test #12:

score: 0
Accepted
time: 2ms
memory: 4184kb

input:

18500

output:

6168 18500

result:

ok single line: '6168 18500'

Test #13:

score: 0
Accepted
time: 3ms
memory: 5972kb

input:

52029

output:

17343 52029

result:

ok single line: '17343 52029'

Test #14:

score: 0
Accepted
time: 1ms
memory: 7336kb

input:

74707

output:

24903 74707

result:

ok single line: '24903 74707'

Test #15:

score: 0
Accepted
time: 6ms
memory: 9324kb

input:

114210

output:

38070 114210

result:

ok single line: '38070 114210'

Test #16:

score: 0
Accepted
time: 2ms
memory: 9980kb

input:

124079

output:

41359 124079

result:

ok single line: '41359 124079'

Test #17:

score: 0
Accepted
time: 2ms
memory: 10616kb

input:

140227

output:

46743 140227

result:

ok single line: '46743 140227'

Test #18:

score: 0
Accepted
time: 5ms
memory: 11156kb

input:

149321

output:

49773 149321

result:

ok single line: '49773 149321'

Test #19:

score: 0
Accepted
time: 8ms
memory: 11768kb

input:

158606

output:

52870 158606

result:

ok single line: '52870 158606'

Test #20:

score: 0
Accepted
time: 4ms
memory: 12968kb

input:

178985

output:

59661 178985

result:

ok single line: '59661 178985'

Test #21:

score: 0
Accepted
time: 11ms
memory: 14288kb

input:

203822

output:

67942 203822

result:

ok single line: '67942 203822'

Test #22:

score: 0
Accepted
time: 6ms
memory: 14504kb

input:

211113

output:

70371 211113

result:

ok single line: '70371 211113'

Test #23:

score: 0
Accepted
time: 11ms
memory: 14744kb

input:

211702

output:

70568 211702

result:

ok single line: '70568 211702'

Test #24:

score: 0
Accepted
time: 4ms
memory: 16164kb

input:

239252

output:

79752 239252

result:

ok single line: '79752 239252'

Test #25:

score: 0
Accepted
time: 12ms
memory: 16904kb

input:

251157

output:

83719 251157

result:

ok single line: '83719 251157'

Test #26:

score: 0
Accepted
time: 0ms
memory: 17688kb

input:

268701

output:

89567 268701

result:

ok single line: '89567 268701'

Test #27:

score: 0
Accepted
time: 3ms
memory: 19092kb

input:

292633

output:

97545 292633

result:

ok single line: '97545 292633'

Test #28:

score: 0
Accepted
time: 11ms
memory: 22792kb

input:

355864

output:

118622 355864

result:

ok single line: '118622 355864'

Test #29:

score: 0
Accepted
time: 11ms
memory: 24284kb

input:

385320

output:

128440 385320

result:

ok single line: '128440 385320'

Test #30:

score: 0
Accepted
time: 11ms
memory: 25780kb

input:

414180

output:

138060 414180

result:

ok single line: '138060 414180'

Test #31:

score: 0
Accepted
time: 12ms
memory: 27580kb

input:

447973

output:

149325 447973

result:

ok single line: '149325 447973'

Test #32:

score: 0
Accepted
time: 12ms
memory: 28460kb

input:

462908

output:

154304 462908

result:

ok single line: '154304 462908'

Test #33:

score: 0
Accepted
time: 17ms
memory: 29264kb

input:

473412

output:

157804 473412

result:

ok single line: '157804 473412'

Test #34:

score: 0
Accepted
time: 16ms
memory: 31028kb

input:

511511

output:

170503 511511

result:

ok single line: '170503 511511'

Test #35:

score: 0
Accepted
time: 20ms
memory: 32600kb

input:

539439

output:

179813 539439

result:

ok single line: '179813 539439'

Test #36:

score: 0
Accepted
time: 24ms
memory: 35236kb

input:

586698

output:

195566 586698

result:

ok single line: '195566 586698'

Test #37:

score: 0
Accepted
time: 20ms
memory: 39800kb

input:

673221

output:

224407 673221

result:

ok single line: '224407 673221'

Test #38:

score: 0
Accepted
time: 24ms
memory: 40664kb

input:

683861

output:

227953 683861

result:

ok single line: '227953 683861'

Test #39:

score: 0
Accepted
time: 27ms
memory: 42180kb

input:

711682

output:

237228 711682

result:

ok single line: '237228 711682'

Test #40:

score: 0
Accepted
time: 28ms
memory: 43116kb

input:

727899

output:

242633 727899

result:

ok single line: '242633 727899'

Test #41:

score: 0
Accepted
time: 20ms
memory: 43560kb

input:

738039

output:

246013 738039

result:

ok single line: '246013 738039'

Test #42:

score: 0
Accepted
time: 20ms
memory: 44552kb

input:

754671

output:

251557 754671

result:

ok single line: '251557 754671'

Test #43:

score: 0
Accepted
time: 25ms
memory: 47768kb

input:

815233

output:

271745 815233

result:

ok single line: '271745 815233'

Test #44:

score: 0
Accepted
time: 26ms
memory: 49260kb

input:

843192

output:

281064 843192

result:

ok single line: '281064 843192'

Test #45:

score: 0
Accepted
time: 32ms
memory: 52484kb

input:

898513

output:

299505 898513

result:

ok single line: '299505 898513'

Test #46:

score: 0
Accepted
time: 34ms
memory: 55412kb

input:

955601

output:

318533 955601

result:

ok single line: '318533 955601'

Test #47:

score: 0
Accepted
time: 30ms
memory: 55980kb

input:

967629

output:

322543 967629

result:

ok single line: '322543 967629'

Test #48:

score: 0
Accepted
time: 15ms
memory: 57288kb

input:

990687

output:

330229 990687

result:

ok single line: '330229 990687'

Test #49:

score: 0
Accepted
time: 28ms
memory: 57876kb

input:

999999

output:

333333 999999

result:

ok single line: '333333 999999'

Test #50:

score: 0
Accepted
time: 44ms
memory: 57864kb

input:

1000000

output:

333334 1000000

result:

ok single line: '333334 1000000'

Extra Test:

score: 0
Extra Test Passed