Submission #1293232


Source Code Expand

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <algorithm>

#define VALUE(a,name) printVal((a),(name))
#define GET(a) readNext<a>()

inline std::string IntToString(long long a){
  char x[100];
  sprintf(x,"%lld",a);
  std::string s = x;
  return s;
}

inline long long StringToInt(std::string a){
  char x[100]; long long res;
  strcpy(x,a.c_str());
  sscanf(x,"%lld",&res);
  return res;
}

inline long long CharToInt(char c) {
    return (c - '0');
}

template<typename T>
inline void printVal(T a,std::string name) {
  std::cout << "The Value of " << name << " is: " << a << std::endl;
}

template<typename T>
inline void printVal(std::vector<T> a,std::string name) {
  std::cout << "The Value of " << name << " is: "<< "[";
  for(int i = 0; i < a.size(); i++) {
    if(i == a.size()-1) {
      std::cout << a.at(i) << "]" << std::endl;
    }else {
      std::cout << a.at(i) << ",";
    }
  }
}

template<typename T>
inline T readNext(){
  T s;
  std::cin >> s;
  return s;
}

struct headline {
  std::map<char,int> m;
};

int main() {

  std::cout << "STarted" << std::endl;

  std::string abc = "abcdefghijklmnopqrstuvwxyz";
  std::vector<headline> ins;

  int n = GET(int);
  for(int i = 0; i < n; i++) {
    std::map<char,int> m;
    std::string s = GET(std::string);
    for(int j = 0; j < s.length(); j++) {
      m[s[j]] += 1;
    }

    /*for(int i = 0; i < abc.length(); i++) {
      std::cout << abc[i] << " - " << m[abc[i]] << std::endl;
    }*/
    headline h = {m};
    ins.push_back(h);
  }

  std::cout << "ReadData" << std::endl;

  std::string usableChars = "";


  for(int i = 0; i < abc.length(); i++) {
      bool s = true;
      char cur = abc[i];
      int lowest = 999999;
      for(int j = 0; j < ins.size(); j++) {
        if(ins.at(j).m[cur] < lowest) {
          lowest = ins.at(j).m[cur];
        }
      }
      if(lowest == 0) {
        s = false;
      }else {
        for(int j = 0; j < ins.size(); j++) {
          if(ins.at(j).m[cur] >= lowest) {
            continue;
          }else {
            s = false;
            break;
          }
        }
      }

      if(s) {
        for(int j = 0; j < lowest; j++) {
          usableChars += cur;
        }
      }

  }

  std::sort(usableChars.begin(), usableChars.end());

  std::cout << usableChars << std::endl;

  return 0;
}

Submission Info

Submission Time
Task C - Dubious Document
User venon
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2530 Byte
Status WA
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
WA × 2
WA × 10
Set Name Test Cases
Sample 0_000.txt, 0_001.txt
All 0_000.txt, 0_001.txt, dec_half.txt, hand.txt, max.txt, max_10.txt, max_5.txt, maxx.txt, rnd.txt, single.txt
Case Name Status Exec Time Memory
0_000.txt WA 1 ms 256 KB
0_001.txt WA 1 ms 256 KB
dec_half.txt WA 1 ms 256 KB
hand.txt WA 2 ms 256 KB
max.txt WA 2 ms 256 KB
max_10.txt WA 2 ms 256 KB
max_5.txt WA 2 ms 256 KB
maxx.txt WA 2 ms 256 KB
rnd.txt WA 2 ms 256 KB
single.txt WA 1 ms 256 KB