文章

1

粉丝

187

获赞

1

访问

2.2k

头像
动态规划
P1154 清华大学上机题
发布于2023年3月5日 21:49
阅读数 2.2k

#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cstring>

using namespace std;

typedef long long int ll;

int cnt = 1;
int M, N;

unordered_map<ll, int> database;
int q, w, e, r;
int getid(int a, int b, int c, int d)
{
    ll id = a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
    if (database[id] == 0)
    {
        database[id] = cnt;
        ++cnt;
    }
    return database[id];
}

vector<int> agent;
vector<int> server;

char ad[16];

int dp[6000][1010];

int DP(int step, int A)
{
    if (dp[step][A] != 99999)
    {
        return dp[step][A];
    }
    if (server[step] == A)
    {
...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发