Submission #1213010


Source Code Expand

#include <bits/stdc++.h>

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.1415926535897932384626

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

int n, l, r;
char s[10005][25];

struct name{
	char t[25];
	int id;
	bool operator<(const name & k) const{
		if(!strcmp(t, k.t)) return id < k.id;
		else return strcmp(t, k.t) < 0;
	}
};

name u[10005];

int main(){
	scanf("%d", &n);
	FI(i, 1, n + 1) scanf(" %s", s[i]);
	//first
	FI(i, 1, n){
		int len = strlen(s[i]);
		FI(j, 0, len - 1){
			if(s[i][j] == '?') u[i].t[j] = 'z';
			else u[i].t[j] = s[i][j];
		}
		u[i].id = i;
	}
	strcpy(u[n + 1].t, s[n + 1]);
	u[n + 1].id = 0;
	sort(u + 1, u + n + 2);
	FI(i, 1, n + 1) if(u[i].id == 0){
		l = i;
		break;
	}
	//last
	FI(i, 1, n){
		int len = strlen(s[i]);
		FI(j, 0, len - 1){
			if(s[i][j] == '?') u[i].t[j] = 'a';
			else u[i].t[j] = s[i][j];
		}
		u[i].id = i;
	}
	strcpy(u[n + 1].t, s[n + 1]);
	u[n + 1].id = n + 1;
	sort(u + 1, u + n + 2);
	FI(i, 1, n + 1) if(u[i].id == n + 1){
		r = i;
		break;
	}
	FI(i, l, r) printf("%d%c", i, i == r ? '\n':' ');
	return 0;
}

Submission Info

Submission Time
Task A - Atcoder Handles
User alex20030190
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1321 Byte
Status WA
Exec Time 6 ms
Memory 768 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:33:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
./Main.cpp:34:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  FI(i, 1, n + 1) scanf(" %s", s[i]);
                                    ^

Judge Result

Set Name Subtask1 Subtask2
Score / Max Score 0 / 130 0 / 120
Status
AC × 2
WA × 1
AC × 2
WA × 4
Set Name Test Cases
Subtask1 sub1_in1.txt, sub1_in2.txt, sub1_in3.txt
Subtask2 sub1_in1.txt, sub1_in2.txt, sub1_in3.txt, sub2_in1.txt, sub2_in2.txt, sub2_in3.txt
Case Name Status Exec Time Memory
sub1_in1.txt AC 6 ms 764 KB
sub1_in2.txt WA 1 ms 256 KB
sub1_in3.txt AC 1 ms 256 KB
sub2_in1.txt WA 1 ms 256 KB
sub2_in2.txt WA 4 ms 512 KB
sub2_in3.txt WA 6 ms 768 KB