QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#108780#6391. Airplanecyan17#22 46ms16372kbC++171.9kb2023-05-26 17:20:062024-05-31 13:43:03

Judging History

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

  • [2024-05-31 13:43:03]
  • 评测
  • 测评结果:22
  • 用时:46ms
  • 内存:16372kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-26 17:20:06]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;

#define int long long
#define fr first
#define sc second
#define eb emplace_back
const char nl = '\n';

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");} 
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "LINE(" << __LINE__ << ") -> " <<"[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif

void solve() {

}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n, m; cin >> n >> m;
    int a[n + 1]; for(int i = 1; i <= n; ++i) cin >> a[i];
    vector<int> adj[n + 1];
    for(int i = 0; i < m; ++i) {
        int u, v; cin >> u >> v;
        adj[u].eb(v); adj[v].eb(u);
    }

    int res = 0;
    int mx = 0, mn = 0;
    for(int i = 2; i <= n; ++i) {
        ++res;
        ++mx; --mn;
        if(mn < a[i]) mn = a[i];
        if(mx < a[i]) {
            res += a[i] - mx;
            mx = a[i];
        }
    }
    res += mn;
    cout << res;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 22
Accepted

Test #1:

score: 22
Accepted
time: 31ms
memory: 16024kb

input:

200000 199999
0 199 58 60 83 5 10 182 87 65 104 153 197 137 80 143 34 181 62 48 10 57 86 58 117 10 171 188 95 52 95 140 126 0 196 85 87 14 10 139 177 92 31 18 102 146 68 9 91 124 156 38 41 121 183 10 32 174 171 29 49 26 118 1 69 185 57 168 54 159 195 95 9 32 195 70 85 174 158 82 33 197 66 189 198 11...

output:

200378

result:

ok single line: '200378'

Test #2:

score: 22
Accepted
time: 38ms
memory: 16144kb

input:

200000 199999
0 7069 4413 15143 13876 8264 277 9620 7202 15692 14258 2614 13807 19768 18946 6508 4536 16015 11178 18780 13194 3126 15666 16341 13700 1400 17159 3289 11433 12997 4482 5897 10872 14089 17849 6479 3144 15034 9891 8465 13826 16423 12149 10812 5239 7420 17792 11494 11072 14771 3344 1911 1...

output:

239619

result:

ok single line: '239619'

Test #3:

score: 22
Accepted
time: 46ms
memory: 16080kb

input:

200000 199999
0 105078 122546 3300 193124 162196 69895 44289 178129 76428 110386 190856 77392 65308 189161 64387 71902 24922 105657 120731 46153 5597 21052 162261 196023 77743 170963 54028 139193 127878 140113 14217 151317 128769 23380 173618 110336 93825 77571 122871 173360 169754 1966 42143 54356 ...

output:

598642

result:

ok single line: '598642'

Test #4:

score: 22
Accepted
time: 38ms
memory: 16108kb

input:

200000 199999
0 55732397 60901872 31713584 64282037 77463086 78130904 29236225 77464050 12326209 35695263 99111327 44848052 73919813 99361339 64031085 21963112 46146914 19581700 98473686 21087087 54242856 62653021 31055752 36441739 13724968 81971647 69716899 10572812 27326027 48563556 20931826 95015...

output:

200183729

result:

ok single line: '200183729'

Test #5:

score: 22
Accepted
time: 39ms
memory: 16020kb

input:

200000 199999
0 14153985 80225532 13272347 34066896 98185012 58062091 42430466 1823846 68143435 98863385 71308404 30332450 96686087 79020069 30750664 7480097 90526895 28301108 29865758 30753745 29430412 20492643 57777905 13997322 80476824 96242732 85284473 91285058 40216138 34285402 69762369 1812243...

output:

200174572

result:

ok single line: '200174572'

Test #6:

score: 22
Accepted
time: 43ms
memory: 16372kb

input:

200000 199999
0 78942231 91484664 79018559 78574515 18404287 11722912 92098054 96690803 62113825 96826208 44496692 77166407 34844511 75375756 99899481 96108473 66849554 85354565 91982705 13456318 96084293 91552364 57499245 65232087 40896788 46634074 45492461 54045567 59320404 65370441 74893985 52947...

output:

200183449

result:

ok single line: '200183449'

Test #7:

score: 22
Accepted
time: 0ms
memory: 3572kb

input:

2 1
0 0
1 2

output:

1

result:

ok single line: '1'

Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 1ms
memory: 3520kb

input:

6 10
0 0 6 1 8 0
5 6
2 3
5 4
6 4
3 5
6 2
3 6
3 4
3 1
6 1

output:

16

result:

wrong answer 1st lines differ - expected: '1', found: '16'

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%