Submission #823191

# Submission time Handle Problem Language Result Execution time Memory
823191 2023-08-12T09:07:08 Z sysia Plahte (COCI17_plahte) C++17
0 / 160
2000 ms 417992 KB
//Sylwia Sapkowska
#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
using namespace std;

void __print(int x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << "'" << x << "'";}
void __print(const char *x) {cerr << '"' << x << '"';}
void __print(const string &x) {cerr << '"' << x << '"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef LOCAL
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define int long long
typedef pair<int, int> T;
const int oo = 1e18, oo2 = 1e9+7, K = 30;
const int mod = 998244353;

struct rec{
    int a, b, c, d; 
    rec(){}
    rec(int _a, int _b, int _c, int _d): a(_a), b(_b), c(_c), d(_d) {}
};

void solve(){
    int n, m; cin >> n >> m;
    vector<rec>tab;
    for (int i = 0; i<n; i++){
        int a, b, c, d; cin >> a >> b >> c >> d;
        tab.emplace_back(a, b, c, d);
    }
    vector<T>p(m);
    vector<int>color(m), scaler;
    for (int i = 0; i<m; i++){
        cin >> p[i].first >> p[i].second >> color[i];
    }
    auto inside = [&](int i, int j) {
        auto [x, y] = p[j];
        return (tab[i].a <= x && x <= tab[i].c && tab[i].b <= y && y <= tab[i].d);
    };
    vector<set<int>>s(n);
    for (int i = 0; i<n; i++){
        for (int j = 0; j<m; j++){
            if (inside(i, j)){
                s[i].insert(color[j]);
            }
        }
    }
    for (int i = 0; i<n; i++){
        cout << (int)s[i].size() << "\n";
    }
}

int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    //cin >> t;
    while (t--) solve();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2077 ms 269460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2043 ms 417992 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2075 ms 396564 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2066 ms 336108 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2079 ms 349056 KB Time limit exceeded
2 Halted 0 ms 0 KB -