답안 #989673

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
989673 2024-05-28T14:28:39 Z Hadi_Alhamed Tracks in the Snow (BOI13_tracks) C++17
2.1875 / 100
210 ms 16048 KB
// to live is to die
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpl;
#define Clear(a, n)              \
    for (int i = 0; i <= n; i++) \
    {                            \
        a[i] = 0;                \
    }
#define clearMat(a, n, m, d)         \
    for (int i = 0; i <= n; i++)     \
    {                                \
        for (int j = 0; j <= m; j++) \
            a[i][j] = d;             \
    }
#define YES cout << "YES\n"
#define NO cout << "NO\n"
#define PB push_back
#define PF push_front
#define MP make_pair
#define F first
#define S second
#define rep(i, n) for (int i = 0; i < n; i++)
#define repe(i, j, n) for (int i = j; i < n; i++)
#define SQ(a) (a) * (a)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define Rrep(i, start, finish) for (int i = start; start >= finish; i--)

#define forn(i, Start, End, step) for (int i = Start; i <= End; i += step)
#define rforn(i, Start, End, step) for (int i = Start; i >= End; i -= step)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
// ll arr[SIZE];
/*
how to find n % mod ; n < 0?
x = (n+mod)%mod
if(x < 0) x += mod;
*/
void __print(int x)
{
    cerr << x;
}
void __print(long x)
{
    cerr << x;
}
void __print(long long x)
{
    cerr << x;
}
void __print(unsigned x)
{
    cerr << x;
}
void __print(unsigned long x)
{
    cerr << x;
}
void __print(unsigned long long x)
{
    cerr << x;
}
void __print(float x)
{
    cerr << x;
}
void __print(double 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...);
}
#ifndef ONLINE_JUDGE
#define db(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define db(x...)
#endif

// order_of_key(k): # of elements less than k (which is the index of x = k)
// find_by_order(k); iterator of the k-th element

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T>
bool ckmin(T &a, const T &b)
{
    return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T &a, const T &b)
{
    return a < b ? a = b, 1 : 0;
}
template <typename T>
istream &operator>>(istream &in, vector<T> &a)
{
    for (auto &x : a)
        in >> x;
    return in;
};
template <typename T>
ostream &operator<<(ostream &out, vector<T> &a)
{
    for (auto &x : a)
        out << x << ' ';
    return out;
};

// priority_queue<data type , the container that would hold the values , greater<pair<int,int>>>
// greater means that we want the smallest value on top
// less means that we want the largest
// x ^ (n) mod m = ( (x mod m)^(n) ) mod m
char to_char(int num)
{
    return (char)(num + '0');
}

ll const MAX = 1e18 + 1;
ll const oo = 1e18 + 1;
ll const INF = 1e9 + 10;
const ll MOD = 1e9 + 7;
ll const SIZE = 2e5 + 900;
const int LOG = 20;

template <typename T, typename T2>
void add(T &X, T2 Y)
{
    X += Y;
    if (X >= MOD)
    {
        X -= MOD;
    }
}

template <typename T, typename T2>
T mult(T X, T2 Y)
{
    return X * Y % MOD;
}

void setIO(string s)
{
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}
// x & (-x) give me the minBit of x
//  x & (x - 1) turns off rightmost bit
ll LCM(ll a, ll b)
{
    return a /__gcd(a, b) * b;
}
void solve()
{

        int H , W;
        cin >> H >> W;
        set<char>s;
        rep(i , H)
        {
            rep(j ,W)
            {
                char c ;cin >> c;
                if(c == '.')continue;
                s.insert(c);
            }
        }
        cout << s.size() << "\n";

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //    setIO("");

    int T = 1;
//    cin >> T;

    while (T--)
    {
        solve();
    }
    return 0;
}

/* stuff you should look for
 * WRITE STUFF DOWN,  ON PAPER
 * BFS THEN DFS
 * int overflow, array bounds
 * special cases (n=1?)
 * do sm th instead of nothing and stay organized
 * DON'T GET STUCK ON ONE APPROACH
 * (STUCK?)******** Try to simplify the problem(keeping in mind the main problem), ():
 * 1- problem to subProblem
 * 2- from simple to complex: start with a special
 *    problem and then try to update the solution for general case
 *    -(constraints - > solve it with none , one,two ... of them till you reach the given problem
      -(no constraints - > try to give it some)
      -how a special case may be incremented
 * 3-Simplification by Assumptions
 * REVERSE PROBLEM
 * PROBLEM ABSTRACTION
 * SMALL O BSERVATIONS MIGHT HELP ALOT
 * WATCH OUT FOR TIME
 * RETHINK YOUR IDEA,BETTER IDEA, APPROACH?
 * CORRECT IDEA, NEED MORE OBSERVATIONS
 * CORRECT APPROACH, WRONG IDEA
 * WRONG APPROACH
 * THINK CONCRETE THEN SYMBOL,
 * having the solution for the first m state , can we solve it for m + 1 ?
 * in many cases incremental thinking needs data sorting
 */

Compilation message

tracks.cpp: In function 'void setIO(std::string)':
tracks.cpp:203:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  203 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tracks.cpp:204:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  204 |     freopen((s + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 600 KB Output isn't correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Incorrect 3 ms 468 KB Output isn't correct
5 Incorrect 1 ms 348 KB Output isn't correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Incorrect 0 ms 348 KB Output isn't correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Incorrect 1 ms 348 KB Output isn't correct
11 Incorrect 1 ms 348 KB Output isn't correct
12 Incorrect 2 ms 540 KB Output isn't correct
13 Incorrect 1 ms 348 KB Output isn't correct
14 Incorrect 1 ms 540 KB Output isn't correct
15 Incorrect 5 ms 600 KB Output isn't correct
16 Incorrect 5 ms 604 KB Output isn't correct
17 Incorrect 4 ms 604 KB Output isn't correct
18 Incorrect 2 ms 604 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Incorrect 22 ms 1876 KB Output isn't correct
3 Incorrect 170 ms 15956 KB Output isn't correct
4 Incorrect 40 ms 4012 KB Output isn't correct
5 Incorrect 83 ms 8992 KB Output isn't correct
6 Incorrect 186 ms 16048 KB Output isn't correct
7 Incorrect 1 ms 348 KB Output isn't correct
8 Incorrect 1 ms 348 KB Output isn't correct
9 Incorrect 1 ms 348 KB Output isn't correct
10 Incorrect 1 ms 348 KB Output isn't correct
11 Incorrect 1 ms 516 KB Output isn't correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Incorrect 17 ms 1976 KB Output isn't correct
14 Incorrect 12 ms 1112 KB Output isn't correct
15 Incorrect 17 ms 1208 KB Output isn't correct
16 Incorrect 8 ms 856 KB Output isn't correct
17 Incorrect 45 ms 4256 KB Output isn't correct
18 Incorrect 53 ms 4128 KB Output isn't correct
19 Incorrect 41 ms 3924 KB Output isn't correct
20 Incorrect 33 ms 3760 KB Output isn't correct
21 Incorrect 89 ms 9300 KB Output isn't correct
22 Incorrect 85 ms 9044 KB Output isn't correct
23 Incorrect 96 ms 7980 KB Output isn't correct
24 Incorrect 92 ms 9300 KB Output isn't correct
25 Incorrect 210 ms 15956 KB Output isn't correct
26 Correct 105 ms 12320 KB Output is correct
27 Incorrect 196 ms 16032 KB Output isn't correct
28 Incorrect 181 ms 15956 KB Output isn't correct
29 Incorrect 176 ms 15952 KB Output isn't correct
30 Incorrect 194 ms 15696 KB Output isn't correct
31 Incorrect 163 ms 10284 KB Output isn't correct
32 Incorrect 158 ms 15904 KB Output isn't correct