哭死,lqz已经没救了。
期望得分: 100 + 0 + 100
实际得分: 50 + 0 + 0 / 30
T1 有个本应该是int的数组开成了char,挂了50分。
T2 没做
T3一共写了三个不同的做法,最稳的一个一直到收代码后5min才调出来,考试的时候随便交了一个上去,结果linux下CE,Windows下30
/* 模拟每次得分情况就好 madan坑我50分去 */ #include <cstdio> #include <iostream> #define Max 100 char a[Max]; int f[Max]; #define rg register inline void cmax (int &a, int b) { if (b > a) a = b; } std :: string Name = "soccer", _I = ".in", _O = ".out"; int main (int argc, char *argv[]) { freopen ((Name + _I).c_str (), "r", stdin); freopen ((Name + _O).c_str (), "w", stdout); int N; scanf ("%d", &N); rg int i, j; for (i = 1; i <= N; ++ i) { scanf ("%s", a + 1); for (j = 1; j <= N; ++ j) if (a[j] == 'W') f[i] += 3; else if (a[j] == 'L') f[j] += 3; else if (a[j] == 'D') ++ f[i], ++ f[j]; } int Maxn = 0; for (i = 1; i <= N; ++ i) cmax (Maxn, f[i]); for (i = 1; i <= N; ++ i) if (f[i] == Maxn) printf (i == N ? "%d" : "%d ", i); return 0; }
并不想改T2
/* set 维护一下就好 考场上基本想到了标算 但是维护最长空位置的数据结构我选的是堆 比较难调 set就好多了 每次取出一段,取中点,然后把这段拆成两半,插入回set取 把车开走就需要再维护一个set,存每次拆出的点。 */ #include <cstdio> #include <iostream> #include <set> int N; #define rg register inline void read (int &n) { rg char c = getchar (); for (n = 0; !isdigit (c); c = getchar ()); for (; isdigit (c); n = n * 10 + c - '0', c = getchar ()); } #define Max 1000006 struct D { int l, r; D (int a = 0, int b = 0) : l (a), r (b) {} inline int gl () const { if (l == 1) return r; return r == N ? r - l + 1 : (l + r) / 2 - l + 1; } bool operator < (const D &rhs) const { return gl () == rhs.gl () ? l < rhs.l : (gl () > rhs.gl ()); } }; std :: set <D> A; std :: set <int> B; int a[Max]; int main (int argc, char *argv[]) { freopen ("park.in", "r", stdin); freopen ("park.out", "w", stdout); int M; read (N), read (M); rg int i; #define ir insert A.ir (D (1, N)), B.ir (N + 1), B.ir (0); D n, p; int t, x, e; std :: set <int> :: iterator it; for (; M; -- M) { read (t), read (x); if (t == 1) { n = *A.begin (), A.erase (n); if (n.l == 1) e = 1, n.l = 2, A.ir (n); else if (n.r == N) e = N, n.r = N - 1, A.ir (n); else e = n.l + n.r >> 1, p = n, n.r = e - 1, p.l = e + 1, A.ir (p), A.ir (n); printf ("%d ", a[x] = e); B.ir (e); continue; } it = B.find (a[x]); n.l = *(-- it) + 1, n.r = a[x] - 1, A.erase (n); p.l = a[x] + 1, p.r = *(++++ it) - 1, A.erase (p); n.r = p.r, A.ir (n); B.erase (a[x]), a[x] = 0; } return 0; }