QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#554047#2749. Orphan BackupsTenshi#AC ✓255ms14800kbC++201.2kb2024-09-09 03:04:542024-09-09 03:04:55

Judging History

This is the latest submission verdict.

  • [2024-09-09 03:04:55]
  • Judged
  • Verdict: AC
  • Time: 255ms
  • Memory: 14800kb
  • [2024-09-09 03:04:54]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << ": " << (x) << endl
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()
 
#define x first
#define y second
using pii = pair<int, int>;
using ll = long long;
 
inline void read(int &x){
    int s=0; x=1;
    char ch=getchar();
    while(ch<'0' || ch>'9') {if(ch=='-')x=-1;ch=getchar();}
    while(ch>='0' && ch<='9') s=(s<<3)+(s<<1)+ch-'0',ch=getchar();
    x*=s;
}

map<string, bool> vis;
vector<string> res;

signed main(){
	string s;
	bool fl=false;
	while(getline(cin, s)){
		// debug(s);
		if(s==""){
			fl=true;
			continue;
		}
		
		if(!fl){
			vis[s]=0;
		}
		else{
			string t;
			int idx;
			int cnt=0;
			dwn(i, s.size()-1, 0){
				if(s[i]=='_') ++cnt;
				if(cnt==2){
					idx=i-1;
					break;
				}
			}
			rep(i, 0, idx) t+=s[i];
			if(!vis.count(t)){
				res.pb("F "+s);
			}
			else{
				vis[t]=true;
			}
		}
	}
	
	for(auto &[x, y]: vis) if(!y) res.pb("I "+x);
	
	sort(all(res));
	for(auto &e: res) cout<<e<<"\n";
	if(!res.size()) puts("No mismatches.");
	
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

payroll.xls
projects.doc
employees.dat
products.txt

payroll.xls_1539199053_INCR
employees.dat_1539199053_INCR
payroll.xls_1539112653_INCR
employees.dat_1539112653_INCR
payroll.xls_1539026253_FULL
employees.dat_1539026253_FULL
customers.dat_1539026253_FULL

output:

F customers.dat_1539026253_FULL
I products.txt
I projects.doc

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 239ms
memory: 14724kb

input:

4cxLDcbTXtDC2smqXT0
4cxLDcbTXtDC2smqX_1
4cxLDcbTXtDC2smqX_2
4cxLDcbTXtDC2smqXT3
4cxLDcbTXtDC2smqXT4
4cxLDcbTXtDC2smqXT5
4cxLDcbTXtDC2smqXT6
4cxLDcbTXtDC2smqXT7
4cxLDcbTXtDC2smqXT8
4cxLDcbTXtDC2smqXT9
YaW2279I8X2pZ4B6OL0
YaW2279I8-2pZ4B6OL1
YaW2279I8X2pZ4B6OL2
YaW2279I8X2pZ4B6OL3
YaW2279I8X2pZ4B6OL4
...

output:

No mismatches.

result:

ok single line: 'No mismatches.'

Test #3:

score: 0
Accepted
time: 250ms
memory: 14560kb

input:

4cxLDcbTXtDC2smqX_1
4cxLDcbTXtDC2smqX_2
4cxLDcbTXtDC2smqXT3
4cxLDcbTXtDC2smqXT4
4cxLDcbTXtDC2smqXT5
4cxLDcbTXtDC2smqXT6
4cxLDcbTXtDC2smqXT7
4cxLDcbTXtDC2smqXT8
4cxLDcbTXtDC2smqXT9
YaW2279I8X2pZ4B6OL0
YaW2279I8-2pZ4B6OL1
YaW2279I8X2pZ4B6OL2
YaW2279I8X2pZ4B6OL3
YaW2279I8X2pZ4B6OL4
YaW2279I8X2pZ4B6OL5
...

output:

F 4cxLDcbTXtDC2smqXT0_1500446148_F
F 4cxLDcbTXtDC2smqXT0_1500550355_INCR
F 4cxLDcbTXtDC2smqXT0_1500705607_DIFFER
F 4tf53Pikl7hR2TwDNB9_1501564341_F
F 4tf53Pikl7hR2TwDNB9_1501613241_INCR
F 4tf53Pikl7hR2TwDNB9_1501813254_DIFFER

result:

ok 6 lines

Test #4:

score: 0
Accepted
time: 251ms
memory: 14496kb

input:

4cxLDcbTXtDC2smqXT0
4cxLDcbTXtDC2smqX_1
4cxLDcbTXtDC2smqX_2
4cxLDcbTXtDC2smqXT3
4cxLDcbTXtDC2smqXT4
4cxLDcbTXtDC2smqXT5
4cxLDcbTXtDC2smqXT6
4cxLDcbTXtDC2smqXT7
4cxLDcbTXtDC2smqXT8
4cxLDcbTXtDC2smqXT9
YaW2279I8X2pZ4B6OL0
YaW2279I8-2pZ4B6OL1
YaW2279I8X2pZ4B6OL2
YaW2279I8X2pZ4B6OL3
YaW2279I8X2pZ4B6OL4
...

output:

No mismatches.

result:

ok single line: 'No mismatches.'

Test #5:

score: 0
Accepted
time: 249ms
memory: 14800kb

input:

4cxLDcbTXtDC2smqXT0
4cxLDcbTXtDC2smqX_1
4cxLDcbTXtDC2smqX_2
4cxLDcbTXtDC2smqXT3
4cxLDcbTXtDC2smqXT4
4cxLDcbTXtDC2smqXT5
4cxLDcbTXtDC2smqXT6
4cxLDcbTXtDC2smqXT7
4cxLDcbTXtDC2smqXT8
4cxLDcbTXtDC2smqXT9
YaW2279I8X2pZ4B6OL0
YaW2279I8-2pZ4B6OL1
YaW2279I8X2pZ4B6OL2
YaW2279I8X2pZ4B6OL3
YaW2279I8X2pZ4B6OL4
...

output:

I 4cxLDcbTXtDC2smqXT0
I 4tf53Pikl7hR2TwDNB9
I I7Lbfg0cSbMDedOBV85
I LmHJpdD0ik0JVQORdZ_
I wzLwSJ4TUOFDMw0q7z7

result:

ok 5 lines

Test #6:

score: 0
Accepted
time: 255ms
memory: 14436kb

input:

4cxLDcbTXtDC2smqXT0
4cxLDcbTXtDC2smqX_1
4cxLDcbTXtDC2smqX_2
4cxLDcbTXtDC2smqXT3
4cxLDcbTXtDC2smqXT4
4cxLDcbTXtDC2smqXT5
4cxLDcbTXtDC2smqXT6
4cxLDcbTXtDC2smqXT7
4cxLDcbTXtDC2smqXT8
4cxLDcbTXtDC2smqXT9
YaW2279I8X2pZ4B6OL0
YaW2279I8-2pZ4B6OL1
YaW2279I8X2pZ4B6OL2
YaW2279I8X2pZ4B6OL3
YaW2279I8X2pZ4B6OL4
...

output:

F 0N8RgvPJ3D2Kj9BH6E7_1503801384_F
F 0N8RgvPJ3D2Kj9BH6E7_1503833632_INCR
F 0N8RgvPJ3D2Kj9BH6E7_1503995480_DIFFER
F 3GDlQ80IR0eXYWTF123_1502274147_F
F 3GDlQ80IR0eXYWTF123_1502466621_INCR
F 3GDlQ80IR0eXYWTF123_1502521595_DIFFER
F aUmvQHohQv4tVFXKwl0_1504078416_F
F aUmvQHohQv4tVFXKwl0_1504087518_INCR
F...

result:

ok 41 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

payroll.xls
projects.doc
employees.dat
products.txt

payroll.xls_1539199053_INCR
employees.dat_1539199053_INCR
payroll.xls_1539112653_INCR
employees.dat_1539112653_INCR
payroll.xls_1539026253_FULL
employees.dat_1539026253_FULL
products.txt_1540001001_FULL
payroll.xls_1539200100_INCR

output:

I projects.doc

result:

ok single line: 'I projects.doc'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

payroll.xls
projects.doc
hr_information.doc
employees.dat
products.txt

payroll.xls_1539199053_INCR
employees.dat_1539199053_INCR
payroll.xls_1539112653_INCR
employees.dat_1539112653_INCR
payroll.xls_1539026253_FULL
employees.dat_1539026253_FULL
customers.dat_1539026253_FULL
products.txt_1539026253_...

output:

F customers.dat_1539026253_FULL

result:

ok single line: 'F customers.dat_1539026253_FULL'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

payroll.xls
projects.doc
employees.dat
products.txt

payroll.xls_1539199053_INCR
employees.dat_1539199053_INCR
payroll.xls_1539112653_INCR
employees.dat_1539112653_INCR
payroll.xls_1539026253_FULL
employees.dat_1539026253_FULL
customers.dat_1539026253_FULL
products.txt_1539026253_FULL
projects.doc_1...

output:

F customers.dat_1539026253_FULL
F hr_information.doc_1539026253_FULL

result:

ok 2 lines

Test #10:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

payroll.xls
projects.doc
customers.dat
hr_information.doc
employees.dat
products.txt

payroll.xls_1539199053_INCR
employees.dat_1539199053_INCR
payroll.xls_1539112653_INCR
employees.dat_1539112653_INCR
payroll.xls_1539026253_FULL
employees.dat_1539026253_FULL
customers.dat_1539026253_FULL
products.t...

output:

No mismatches.

result:

ok single line: 'No mismatches.'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

dategeneral-info_1
dategeneral-info
dategeneral-info_0
dategeneral-info_2
payroll.xls
projects.doc
employees.dat
products.txt

payroll.xls_1539199053_INCR
dategeneral-info_1_1539664703_FULL
employees.dat_1539199053_INCR
payroll.xls_1539112653_INCR
dategeneral-info_1539664703_FULL
employees.dat_15391...

output:

I projects.doc

result:

ok single line: 'I projects.doc'

Test #12:

score: 0
Accepted
time: 11ms
memory: 4112kb

input:

4cxLDcbTXtDC2smqX_1
4cxLDcbTXtDC2smqX_2
4cxLDcbTXtDC2smqXT3
4cxLDcbTXtDC2smqXT4
4cxLDcbTXtDC2smqXT5
4cxLDcbTXtDC2smqXT6
4cxLDcbTXtDC2smqXT7
4cxLDcbTXtDC2smqXT8
4cxLDcbTXtDC2smqXT9
FSSBps6UmOAvZB6JMe0
FSSBps6UmOAvZB6JMe1
FSSBps6UmOAvZB6JMe2
FSSBps6UmOAvZB6JMe3
FSSBps6UmOAvZB6JMe4
FSSBps6UmOAvZB6JMe5
...

output:

F 4cxLDcbTXtDC2smqXT0_1500446148_F
F 4cxLDcbTXtDC2smqXT0_1500550355_INCR
F 4cxLDcbTXtDC2smqXT0_1500705607_DIFFER
F 4tf53Pikl7hR2TwDNB9_1501564341_F
F 4tf53Pikl7hR2TwDNB9_1501613241_INCR
F 4tf53Pikl7hR2TwDNB9_1501813254_DIFFER

result:

ok 6 lines

Test #13:

score: 0
Accepted
time: 10ms
memory: 4192kb

input:

FGEs0pcbRoAmKxx3YZ5
FGEs0pcbRoAmKxx3YZ6
FGEs0pcbRoAmKxx3YZ7
FwH0RjQY94RsxyhUU51
FwH0RjQY94RsxyhUU52
FwH0RjQY94RsxyhUU53
4klYPH9NrvCinCL3sr6
4klYPH9NrvCinCL3sr7
4klYPH9NrvCinCL3sr8
4klYPH9NrvCinCL3sr9

4cxLDcbTXtDC2smqXT0_1500446148_F
4cxLDcbTXtDC2smqXT0_1500550355_INCR
4cxLDcbTXtDC2smqXT0_1500705607...

output:

F 40uC1xORnnVsLjyXyz0_1500125896_F
F 40uC1xORnnVsLjyXyz0_1500161339_INCR
F 40uC1xORnnVsLjyXyz0_1500202769_DIFFER
F 40uC1xORnnVsLjyXyz1_1501288458_F
F 40uC1xORnnVsLjyXyz1_1501446251_INCR
F 40uC1xORnnVsLjyXyz1_1501477616_DIFFER
F 40uC1xORnnVsLjyXyz2_1503176150_F
F 40uC1xORnnVsLjyXyz2_1503275323_INCR
F...

result:

ok 13470 lines

Test #14:

score: 0
Accepted
time: 3ms
memory: 4524kb

input:

4cxLDcbTXtDC2smqX_1
4cxLDcbTXtDC2smqX_2
4cxLDcbTXtDC2smqXT3
4cxLDcbTXtDC2smqXT4
4cxLDcbTXtDC2smqXT5
4cxLDcbTXtDC2smqXT6
4cxLDcbTXtDC2smqXT7
4cxLDcbTXtDC2smqXT8
4cxLDcbTXtDC2smqXT9
FSSBps6UmOAvZB6JMe0
FSSBps6UmOAvZB6JMe1
FSSBps6UmOAvZB6JMe2
FSSBps6UmOAvZB6JMe3
FSSBps6UmOAvZB6JMe4
FSSBps6UmOAvZB6JMe5
...

output:

I 40uC1xORnnVsLjyXyz0
I 40uC1xORnnVsLjyXyz1
I 40uC1xORnnVsLjyXyz2
I 40uC1xORnnVsLjyXyz3
I 40uC1xORnnVsLjyXyz4
I 40uC1xORnnVsLjyXyz5
I 40uC1xORnnVsLjyXyz6
I 40uC1xORnnVsLjyXyz7
I 40uC1xORnnVsLjyXyz8
I 40uC1xORnnVsLjyXyz9
I 42YUvuQ8z2iau43BlP0
I 42YUvuQ8z2iau43BlP1
I 42YUvuQ8z2iau43BlP2
I 42YUvuQ8z2ia...

result:

ok 4492 lines