QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#449638#8768. Arrested DevelopmentjoltcodeWA 0ms3628kbC++142.3kb2024-06-21 15:35:022024-06-21 15:35:03

Judging History

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

  • [2024-06-21 15:35:03]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3628kb
  • [2024-06-21 15:35:02]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define fr first
#define sc second
#define f(i, x) for(ll i=0; i<x; i++)
#define revn(i, x) for (ll i = x - 1; i >= 0; i--)
#define rp(i,le,ri) for(ll i=le;i<ri;i++)
#define rrp(i,ri,le) for(ll i=ri;i>=le;i--)
#define asort(o) sort((o).begin(), (o).end())
#define dsort(o) sort((o).rbegin(), (o).rend())
#define minhp priority_queue<ll, vector<ll>, greater<>>
#define revhp priority_queue<ll>
typedef pair<int, int> p;
inline ll lcm(ll m,ll n) {return(m*n/__gcd(m,n));}
const int MOD=1e9+7;
const ll INF = INT_MAX, INF2 = LLONG_MAX - 1;
bool cmp(const p &a, const p &b)
{
    return a.fr <= b.fr;
}
int binarySearch(int arr[], int low, int high, int x)
{
    while (low <= high) {
        int mid = low + (high - low) / 2;
        if (arr[mid] == x)
            return mid;
        if (arr[mid] < x)
        low = mid + 1;
        else
            high = mid - 1;
    }
    return -1;
}
vector<bool> v;
vector<vector<int> > g;
void edge(int a, int b)
{
g[a].push_back(b);
}
void bfs(int u)
{
    queue<int> q;
    q.push(u);
    v[u] = true;
    while (!q.empty()) {
        int f = q.front();
        q.pop();
        cout << f << ' ';
        for (auto i = g[f].begin(); i != g[f].end(); i++) {
            if (!v[*i]) {
                q.push(*i);
                v[*i] = true;
            }
        }
    }
}
void dfs(int v, vector<vector<int>>& adj, vector<bool>& visited) {
    visited[v] = true;
    for (int u : adj[v]) {
        if (!visited[u]) {
            dfs(u, adj, visited);
        }
    }
}
int mex(vector<int> const& A, int l, int r) {
    set<int> b(A.begin() + l, A.begin() + r + 1);
    int result = 0;
    while (b.count(result)) ++result;
    return result;
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    int ar[n][2];
    f(j, n)
    cin>>ar[j][0]>>ar[j][1];
    int dp[n][2];
    dp[0][0]=ar[0][0];
    dp[0][1]=ar[0][1];
    for(int j=1; j<n; j++)
    {
        dp[j][0]=min(dp[j-1][0]+ar[j][0], max(dp[j-1][1], ar[j][0]));
        dp[j][1]=min(dp[j-1][1]+ar[j][1], max(dp[j-1][0], ar[j][1]));
    }
    int ans=min(dp[n-1][0], dp[n-1][1]);
    cout<<ans<<endl;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3512kb

input:

4
100 1
1 90
1 20
1 20

output:

3

result:

ok single line: '3'

Test #2:

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

input:

2
314 1
592 6

output:

7

result:

ok single line: '7'

Test #3:

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

input:

1
1 1

output:

1

result:

ok single line: '1'

Test #4:

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

input:

1
100000 1

output:

1

result:

ok single line: '1'

Test #5:

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

input:

1
1 100000

output:

1

result:

ok single line: '1'

Test #6:

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

input:

1
100000 100000

output:

100000

result:

ok single line: '100000'

Test #7:

score: -100
Wrong Answer
time: 0ms
memory: 3620kb

input:

50
78681 95291
22639 1538
12119 52253
50430 63757
66133 92826
61048 40069
33506 30382
96049 50134
42895 62735
86943 16955
9667 61843
49647 9320
29082 16909
69601 68436
19892 34306
29822 79462
73262 14568
1693 35040
89757 61888
56993 48750
89611 77773
54159 21067
32520 41091
52501 92770
36530 17589
5...

output:

97780

result:

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