版本比较
LZM QJ D1 现在是ICPC赛制,可以组内交流
正文
增加 10 行删除 10 行
11 行未改动1213141516171819205 行未改动262728293031323334247 行未改动全部展开28228328428528628728828929029129229327 行未改动32132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035113 行未改动11 行未改动const int N = 1e4 + 5;int n, m, k, s, t, ju[N][15];bool vis[N][15];struct node {int w, to, l; //距离 点编号 通行证使用次数bool operator < (const node & A) const {return w > A.w;}};5 行未改动for (int i = 1; i <= m; i++) {int u, v, w; cin >> u >> v >> w;g[u].push_back(make_pair(v, w));g[v].push_back(make_pair(u, w));}memset(ju, 0x3f, sizeof(ju));ju[s][0] = 0;priority_queue<node> q;q.push({0, s, 0});247 行未改动全部展开```cpp#include<bits/stdc++.h>using namespace std;const int N = 1e3 + 5;struct node {int to, w;};vector<node> a[N];int n, dis[N], r[N], t[N], cnt[N];bool vis[N];bool spfa(int s, int x) {27 行未改动a[0].push_back({i, 0});a[i - 1].push_back({i, 0});a[i].push_back({i - 1, -t[i]});if(i > 8) a[i - 8].push_back({i, r[i]});else a[i + 16].push_back({i, r[i] - x});}return spfa(0, x);}void work() {memset(t, 0, sizeof(t));for(int i = 1; i <= 24; i++) cin >> r[i];cin >> n;for(int i = 1; i <= n; i++) {int x; cin >> x; t[x + 1]++;}for(int i = 0; i <= n; i++) {if(check(i) == 1) {cout << i << "\n"; return;}}cout << "No Solution\n";return;}int main() {int T; cin >> T; while(T--) work();return 0;}```:::13 行未改动11 行未改动1213141516171819205 行未改动262728293031323334247 行未改动全部展开28228328428528628728828929029129229327 行未改动32132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035113 行未改动11 行未改动const int N = 1e4 + 5;int n, m, k, s, t, ju[N][15];bool vis[N][15];struct node {int w, to, l; //距离 点编号 通行证使用次数bool operator < (const node & A) const {return w > A.w;}};5 行未改动for (int i = 1; i <= m; i++) {int u, v, w; cin >> u >> v >> w;g[u].push_back(make_pair(v, w));g[v].push_back(make_pair(u, w));}memset(ju, 0x3f, sizeof(ju));ju[s][0] = 0;priority_queue<node> q;q.push({0, s, 0});247 行未改动全部展开```cpp#include<bits/stdc++.h>using namespace std;const int N = 1e3 + 5;struct node {int to, w;};vector<node> a[N];int n, dis[N], r[N], t[N], cnt[N];bool vis[N];bool spfa(int s, int x) {27 行未改动a[0].push_back({i, 0});a[i - 1].push_back({i, 0});a[i].push_back({i - 1, -t[i]});if(i > 8) a[i - 8].push_back({i, r[i]});else a[i + 16].push_back({i, r[i] - x});}return spfa(0, x);}void work() {memset(t, 0, sizeof(t));for(int i = 1; i <= 24; i++) cin >> r[i];cin >> n;for(int i = 1; i <= n; i++) {int x; cin >> x; t[x + 1]++;}for(int i = 0; i <= n; i++) {if(check(i) == 1) {cout << i << "\n"; return;}}cout << "No Solution\n";return;}int main() {int T; cin >> T; while(T--) work();return 0;}```:::13 行未改动