Submission #519836

# Submission time Handle Problem Language Result Execution time Memory
519836 2022-01-27T11:38:26 Z Monarchuwu Scissors and Tape (CEOI19_scissors) C++17
5 / 100
1000 ms 66056 KB
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;

typedef pair<int, int> pii;
#define ff first
#define ss second

const int N = 1000;
int n, m;
vector<pii> S, T;

void scissors() {
    m = max(S[0].ff, S[2].ff);
    n = max(S[0].ss, S[2].ss);

    cout << "scissors\n";
    cout << "0 " << n * m << '\n';
    for (int i = 0; i < m; ++i)
        for (int j = 0; j < n; ++j) {
            cout << "4 ";
            cout << i << ' ' << j << ' ';
            cout << i + 1 << ' ' << j << '\n';
            cout << i + 1 << ' ' << j + 1 << ' ';
            cout << i << ' ' << j + 1 << ' ';
        }
}

void tape() {
    m = max(T[0].ff, T[2].ff);
    n = max(T[0].ss, T[2].ss);

    cout << "tape\n";
    cout << m * n << ' ';
    for (int i = 1; i <= m * n; ++i) cout << i << ' ';
    cout << '\n';

    for (int i = 0; i < m; ++i)
        for (int j = 0; j < n; ++j) {
            cout << "4 ";
            cout << i << ' ' << j << ' ';
            cout << i + 1 << ' ' << j << '\n';
            cout << i + 1 << ' ' << j + 1 << ' ';
            cout << i << ' ' << j + 1 << ' ';
        }

    cout << "4\n";
    for (pii x : T) cout << x.ff << ' ' << x.ss << ' ';
    cout << '\n';
}

namespace sub2 {
    int m1, n1, m2, n2;
    bool check() {
        m1 = max(S[0].ff, S[2].ff);
        n1 = max(S[0].ss, S[2].ss);
        if (m1 < n1) return false;

        m2 = max(T[0].ff, T[2].ff);
        n2 = max(T[0].ss, T[2].ss);
        return m2 == n2;
    }
    void solve() { // m1 > m2
        if (m1 / m2 >= 2) {
            cout << "scissors\n";
            cout << "0 " << m1 / m2 << '\n';

            for (int i = 0; i < m1; i += m2) {
                cout << "4 ";
                cout << i << ' ' << 0 << ' ';
                cout << i + m2 << ' ' << 0 << '\n';
                cout << i + m2 << ' ' << n1 << ' ';
                cout << i << ' ' << n1 << ' ';
            }

            cout << "tape\n";
            cout << m1 / m2 << ' ';
            for (int i = 1; i <= m1 / m2; ++i) cout << i << ' ';
            cout << '\n';

            for (int j = 0; j < n2; j += n1) {
                cout << "4 ";
                cout << 0 << ' ' << j << ' ';
                cout << m2 << ' ' << j << '\n';
                cout << m2 << ' ' << j + n1 << ' ';
                cout << 0 << ' ' << j + n1 << ' ';
            }

            cout << "4\n";
            for (pii x : T) cout << x.ff << ' ' << x.ss << ' ';
            cout << '\n';
        }
        else {
            // m1 > m2 && n1 < n2
            cout << "scissors\n";
            cout << "0 2\n";

            cout << "4 ";
            cout << 0 << ' ' << 0 << ' ';
            cout << m2 << ' ' << 0 << ' ';
            cout << m2 << ' ' << n1 << ' ';
            cout << 0 << ' ' << n1 << '\n';

            cout << "4 ";
            cout << m2 << ' ' << 0 << ' ';
            cout << m1 << ' ' << 0 << ' ';
            cout << m1 << ' ' << n1 << ' ';
            cout << m2 << ' ' << n1 << '\n';

            cout << "tape\n";
            cout << "2 1 2\n";

            cout << "4 ";
            cout << 0 << ' ' << 0 << ' ';
            cout << m2 << ' ' << 0 << ' ';
            cout << m2 << ' ' << n1 << ' ';
            cout << 0 << ' ' << n1 << '\n';

            cout << "4 ";
            cout << 0 << ' ' << n1 << ' ';
            cout << m2 << ' ' << n1 << ' ';
            cout << m2 << ' ' << n2 << ' ';
            cout << 0 << ' ' << n2 << '\n';

            cout << "4\n";
            for (pii x : T) cout << x.ff << ' ' << x.ss << ' ';
            cout << '\n';
        }
    }
}

int main() {
    cin.tie(NULL)->sync_with_stdio(false);
    cin >> n;
    S.resize(n);
    for (pii &x : S) cin >> x.ff >> x.ss;

    cin >> m;
    T.resize(m);
    for (pii &x : T) cin >> x.ff >> x.ss;

    if (sub2::check()) sub2::solve();
    else {
        scissors();
        tape();
    }
}
/**  /\_/\
 *  (= ._.)
 *  / >0  \>1
**/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB used 204 vertices, largest error was 0.00000000966667
2 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000001150000
3 Correct 0 ms 204 KB used 252 vertices, largest error was 0.00000001200000
4 Correct 0 ms 204 KB used 28 vertices, largest error was 0.00000000800000
5 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000001150000
6 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000000960000
7 Correct 1 ms 204 KB used 92 vertices, largest error was 0.00000000900000
8 Correct 0 ms 204 KB used 252 vertices, largest error was 0.00000000966667
9 Correct 1 ms 204 KB used 252 vertices, largest error was 0.00000001140000
10 Correct 0 ms 204 KB used 44 vertices, largest error was 0.00000000850000
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Operation 2 (tape), polygon 1, vertex 0: Equivalent polygons must not change distance of any side by more than 0.001000, got '117000.000000' vs '195000.000000', error '0.666667'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB used 204 vertices, largest error was 0.00000000966667
2 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000001150000
3 Correct 0 ms 204 KB used 252 vertices, largest error was 0.00000001200000
4 Correct 0 ms 204 KB used 28 vertices, largest error was 0.00000000800000
5 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000001150000
6 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000000960000
7 Correct 1 ms 204 KB used 92 vertices, largest error was 0.00000000900000
8 Correct 0 ms 204 KB used 252 vertices, largest error was 0.00000000966667
9 Correct 1 ms 204 KB used 252 vertices, largest error was 0.00000001140000
10 Correct 0 ms 204 KB used 44 vertices, largest error was 0.00000000850000
11 Incorrect 0 ms 204 KB Operation 2 (tape), polygon 1, vertex 0: Equivalent polygons must not change distance of any side by more than 0.001000, got '117000.000000' vs '195000.000000', error '0.666667'
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Operation 1, Polygon 0: Polygon given in clockwise order, must be counter-clockwise
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 66056 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB used 204 vertices, largest error was 0.00000000966667
2 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000001150000
3 Correct 0 ms 204 KB used 252 vertices, largest error was 0.00000001200000
4 Correct 0 ms 204 KB used 28 vertices, largest error was 0.00000000800000
5 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000001150000
6 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000000960000
7 Correct 1 ms 204 KB used 92 vertices, largest error was 0.00000000900000
8 Correct 0 ms 204 KB used 252 vertices, largest error was 0.00000000966667
9 Correct 1 ms 204 KB used 252 vertices, largest error was 0.00000001140000
10 Correct 0 ms 204 KB used 44 vertices, largest error was 0.00000000850000
11 Incorrect 0 ms 204 KB Operation 2 (tape), polygon 1, vertex 0: Equivalent polygons must not change distance of any side by more than 0.001000, got '117000.000000' vs '195000.000000', error '0.666667'
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB used 204 vertices, largest error was 0.00000000966667
2 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000001150000
3 Correct 0 ms 204 KB used 252 vertices, largest error was 0.00000001200000
4 Correct 0 ms 204 KB used 28 vertices, largest error was 0.00000000800000
5 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000001150000
6 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000000960000
7 Correct 1 ms 204 KB used 92 vertices, largest error was 0.00000000900000
8 Correct 0 ms 204 KB used 252 vertices, largest error was 0.00000000966667
9 Correct 1 ms 204 KB used 252 vertices, largest error was 0.00000001140000
10 Correct 0 ms 204 KB used 44 vertices, largest error was 0.00000000850000
11 Incorrect 0 ms 204 KB Operation 2 (tape), polygon 1, vertex 0: Equivalent polygons must not change distance of any side by more than 0.001000, got '117000.000000' vs '195000.000000', error '0.666667'
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB used 204 vertices, largest error was 0.00000000966667
2 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000001150000
3 Correct 0 ms 204 KB used 252 vertices, largest error was 0.00000001200000
4 Correct 0 ms 204 KB used 28 vertices, largest error was 0.00000000800000
5 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000001150000
6 Correct 0 ms 204 KB used 172 vertices, largest error was 0.00000000960000
7 Correct 1 ms 204 KB used 92 vertices, largest error was 0.00000000900000
8 Correct 0 ms 204 KB used 252 vertices, largest error was 0.00000000966667
9 Correct 1 ms 204 KB used 252 vertices, largest error was 0.00000001140000
10 Correct 0 ms 204 KB used 44 vertices, largest error was 0.00000000850000
11 Incorrect 0 ms 204 KB Operation 2 (tape), polygon 1, vertex 0: Equivalent polygons must not change distance of any side by more than 0.001000, got '117000.000000' vs '195000.000000', error '0.666667'
12 Halted 0 ms 0 KB -