Submission #1757872
Source Code Expand
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<P> VP;
typedef vector<string> VS;
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,0,n)
#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define RLFOR(i,b,a) for(ll i=(b)-1;i>=(a);--i)
#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define dump(x) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";
#define dump2(x,y) cerr << "[L " << __LINE__ << "] " << #x << " = " << (x)\
<< " , " << #y << " = " << (y) << "\n";
const int INF = 1e9;
const double EPS = 1e-10;
int n,m;
ll k;
string s;
VS users;
bool comp(const string &a, const string &b) {
EACH(i, a){
if(i >= (int)b.size()) return false;
if(a[i]!=b[i]) return a[i] < b[i];
}
return a.size() < b.size();
}
int main() {
char buf[1024];
cin.getline(buf, sizeof buf);
string s(buf);
s += " ";
string user = "";
bool lastAt = 0;
REP(i, (int)s.size()){
if(s[i]=='@' || s[i]==' '){
dump(user.size());
if(lastAt && user.size() > 0) users.PB(user);
lastAt = s[i] == '@';
user = "";
}else{
user += s[i];
dump(user);
}
}
dump(users.size());
SORT(users);
UNIQUE(users);
REP(i, users.size()){
cout << users[i] << endl;
}
cout << endl;
}
Submission Info
Submission Time |
|
Task |
C - 次世代SNS |
User |
luma |
Language |
C++14 (GCC 5.4.1) |
Score |
100 |
Code Size |
2038 Byte |
Status |
AC |
Exec Time |
2 ms |
Memory |
256 KB |
Judge Result
Set Name |
All |
Score / Max Score |
100 / 100 |
Status |
|
Set Name |
Test Cases |
All |
sample_01.txt, sample_02.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, sample_01.txt, sample_02.txt |
Case Name |
Status |
Exec Time |
Memory |
sample_01.txt |
AC |
1 ms |
256 KB |
sample_02.txt |
AC |
1 ms |
256 KB |
test_01.txt |
AC |
1 ms |
256 KB |
test_02.txt |
AC |
1 ms |
256 KB |
test_03.txt |
AC |
1 ms |
256 KB |
test_04.txt |
AC |
1 ms |
256 KB |
test_05.txt |
AC |
2 ms |
256 KB |
test_06.txt |
AC |
2 ms |
256 KB |
test_07.txt |
AC |
2 ms |
256 KB |
test_08.txt |
AC |
2 ms |
256 KB |
test_09.txt |
AC |
2 ms |
256 KB |
test_10.txt |
AC |
2 ms |
256 KB |
test_11.txt |
AC |
1 ms |
256 KB |
test_12.txt |
AC |
1 ms |
256 KB |
test_13.txt |
AC |
1 ms |
256 KB |
test_14.txt |
AC |
1 ms |
256 KB |
test_15.txt |
AC |
1 ms |
256 KB |
test_16.txt |
AC |
1 ms |
256 KB |
test_17.txt |
AC |
1 ms |
256 KB |
test_18.txt |
AC |
1 ms |
256 KB |
test_19.txt |
AC |
2 ms |
256 KB |
test_20.txt |
AC |
2 ms |
256 KB |