답안 #287827

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
287827 2020-09-01T03:39:47 Z chubyxdxd ZigZag (COCI17_zigzag) C++17
8 / 80
492 ms 19832 KB
#include <bits/stdc++.h>
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define ff first
#define sc second
#define INF 3000000000
#define SINF 2*(1e18)
#define inf -10000000
#define pb push_back
#define forr(i,p,n) for(int i=p;i<n;i++)
#define mpk make_pair
#define upb(a,s) upper_bound(a.begin(),a.end(),s)
#define lwb(a,s) lower_bound(a.begin(),a.end(),s)
#define mem(a,val) memset(a,val,sizeof a)
#define cc continue
#define eb emplace_back
#define bb break
#define mostbit(n) 32-__builtin_clz(n)-1
#define time_to_forget cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n"
using namespace std;
//using namespace __gnu_pbds;
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie();
    ll a,b,c,d,n,t,m,k;
    cin>>n>>m;
    map<char,multiset<pair<int,string>>> mp;
    map<string,int> mo;
    string s;
    char ch;
    forr(i,0,n){
      cin>>s;
      mp[s[0]].insert(pair<int,string> (0,s));
      mo[s]=0;
    }
    forr(i,0,m){
      cin>>ch;
      auto it=mp[ch].begin();
      cout<<(*it).sc<<endl;
      mp[ch].erase(it);
      mp[ch].insert(pair<int,string> ((*it).ff+1,(*it).sc));
    }
    time_to_forget;
  return 0;
}

Compilation message

zigzag.cpp: In function 'int main()':
zigzag.cpp:30:8: warning: unused variable 'a' [-Wunused-variable]
   30 |     ll a,b,c,d,n,t,m,k;
      |        ^
zigzag.cpp:30:10: warning: unused variable 'b' [-Wunused-variable]
   30 |     ll a,b,c,d,n,t,m,k;
      |          ^
zigzag.cpp:30:12: warning: unused variable 'c' [-Wunused-variable]
   30 |     ll a,b,c,d,n,t,m,k;
      |            ^
zigzag.cpp:30:14: warning: unused variable 'd' [-Wunused-variable]
   30 |     ll a,b,c,d,n,t,m,k;
      |              ^
zigzag.cpp:30:18: warning: unused variable 't' [-Wunused-variable]
   30 |     ll a,b,c,d,n,t,m,k;
      |                  ^
zigzag.cpp:30:22: warning: unused variable 'k' [-Wunused-variable]
   30 |     ll a,b,c,d,n,t,m,k;
      |                      ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Incorrect 1 ms 384 KB Output isn't correct
3 Correct 2 ms 512 KB Output is correct
4 Incorrect 2 ms 384 KB Output isn't correct
5 Incorrect 2 ms 384 KB Output isn't correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 491 ms 19832 KB Output isn't correct
8 Incorrect 487 ms 19832 KB Output isn't correct
9 Incorrect 492 ms 19796 KB Output isn't correct
10 Incorrect 490 ms 19832 KB Output isn't correct